Geeks Talk

Prepare for your Next Interview




Employee and Department Query

This is a discussion on Employee and Department Query within the SQL forums, part of the Databases category; How to retrieve department no that is not having the data in emp table Display all employees who are joined before their manager and they are not managers...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-28-2008
Junior Member
 
Join Date: Mar 2008
Location: India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sriram.bethe is on a distinguished road
Employee and Department Query

How to retrieve department no that is not having the data in emp table

Display all employees who are joined before their manager and they are not managers
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-29-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: Employee and Department Query

Quote:
Originally Posted by sriram.bethe View Post
how to retrieve department no that is not having the data in emp table display all employees who are joined before their manager and they are not managers
select deptno , dname
from dept
where deptno not in (select deptno from emp);

select a.empno,a.ename, a.hiredate from emp a
where a.job <> 'manager'
and a.hiredate < (select hiredate from emp b where a.mgr = b.empno);
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Show department name and department number only once orlando SQL 6 9 Hours Ago 02:00 AM
Employee and manager name in single query Geek_Guest SQL 13 07-17-2008 12:07 PM
employee name and salary from employee and salary table Himu SQL 1 07-04-2007 05:34 AM
Query employee name who is not in dept no 30 Geek_Guest SQL 1 02-22-2007 10:32 AM
howmany students are there in a department ? psuresh1982 Brainteasers 3 01-03-2007 04:42 AM


All times are GMT -4. The time now is 11:59 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved