Matrix Query

Create a query to display the total number of employees, of that total, the number of employees hired in 1995, 1996, 1997, 1998. Create appropriate column heading from the employees table.

Questions by enochnikoi   answers by enochnikoi

Showing Answers 1 - 4 of 4 Answers

mlodugu

  • Apr 10th, 2011
 

How about this?

SELECT SUM(sal) Total_sal, extract(year from hiredate) Yr
FROM scott.emp GROUP BY Rollup(extract(year from hiredate))

  Was this answer useful?  Yes

Prem_p

  • Apr 28th, 2011
 

SELECT count(e.empno) Emp_Count,to_char(e.hiredate,'YYYY') hired_On   
from empoyee e
where to_char(e.hiredate,'YYYY') in (1995, 1996, 1997, 1998)
group by rollup(to_char(e.hiredate,'YYYY')) 
order by 2

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions