You are on page 1of 1

-- 5.

Obtener el total de empleados, y el total de empleados por ao desde el 2001


hasta el 2008.
--Todo en un solo query. Ejemplo del resultado:
--

TOTAL
2001
2002
2003
2004
2005
2006
2007
2008
-- ---------- ---------- ---------- ---------- ---------- ---------- ------------------- ----------107
1
7
6
10
29
24
19
11
select (select count(*) TOTAL FROM EMPLOYEES) AS TOTAL, (SELECT
MPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY') = '2001') "2001",
(select count(1) from EMPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY')
",
(select count(1) from EMPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY')
",
(select count(1) from EMPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY')
",
(select count(1) from EMPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY')
",
(select count(1) from EMPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY')
",
(select count(1) from EMPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY')
",
(select count(1) from EMPLOYEES where TO_CHAR(HIRE_DATE, 'YYYY')
"
from dual;

COUNT(1) from E
= '2002') "2002
= '2003') "2003
= '2004') "2004
= '2005') "2005
= '2006') "2006
= '2007') "2007
= '2008') "2008

You might also like