GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  Basics
Go To First  |  Previous Question  |  Next Question 
 Basics  |  Question 40 of 49    Print  
Create a report for the HR department that displays employee last names, department numbers, and all the employees who work in the same department as a given employee. Give each column an appropriate label.

  
Total Answers and Comments: 4 Last Update: January 10, 2009     Asked by: Kanyarat 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 06, 2007 06:44:42   #1  
srinivas.addala Member Since: April 2007   Contribution: 6    

RE: Create a report for the HR department that display...

Say for ex: Emp data in Table 1 and Dept Name in Table 2.

Now to get a report on employees department wise make a script of filtering data where the employee and his dept is xxxxxx from Table 1 making base dept from Table 2. Similarly the other way also the report can be taken maximum number of employees in a particular department also.

Srinivas


 
Is this answer useful? Yes | No
June 17, 2008 05:04:30   #2  
shamkohli Member Since: June 2008   Contribution: 6    

RE: Create a report for the HR department that displays employee last names, department numbers, and all the employees who work in the same department as a given employee. Give each column an appropriate label.
The query can be in the form

SELECT EMP_NAME DEPT
FROM EMP
WHERE DEPT (SELECT DEPT FROM EMP WHERE EMP_NAME 'ABC');

 
Is this answer useful? Yes | No
December 14, 2008 01:21:20   #3  
kenito Member Since: July 2008   Contribution: 1    

RE: Create a report for the HR department that displays employee last names, department numbers, and all the employees who work in the same department as a given employee. Give each column an appropriate label.
select
e.department_id department
e.last_name employee
c.last_name colleague
from
employees e
employees c
where
e.department_id c.department_id
and
e.last_name <> c.last_name;

 
Is this answer useful? Yes | No
January 10, 2009 12:44:43   #4  
justgeek Member Since: January 2009   Contribution: 1    

RE: Create a report for the HR department that displays employee last names, department numbers, and all the employees who work in the same department as a given employee. Give each column an appropriate label.
select e.deptno e.ename e1.ename
from scott.emp e scott.emp e1
where e.deptno e1.deptno
and e.ename<>e1.ename
order by e.deptno e.ename

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape