create a query that will display the total no.of employees and, of that total, the no.of employees hired in 1995,1996,1997, and 1998. create appropriate column headings.
RE: create a query that will display the total no.of e...
Select
count(emp_code)
count(case when TO_NUMBER(to_CHAR(hire_date 'YYYY')) 1995 then (emp_code) end) as hire_1995
count(case when TO_NUMBER(to_CHAR(hire_date 'YYYY')) 1996 then (emp_code) end) as hire_1996
from employees
--similary the query will continue. remember that the fields are from one table and you are not doing any dimension querying. only the fact info is being queried
RE: create a query that will display the total no.of employees and, of that total, the no.of employees hired in 1995,1996,1997, and 1998. create appropriate column headings.
SELECT COUNT(*) TOTAL_EMP SUM(CASE WHEN INSTR(HIREDATE '81') > 0 THEN 1 ELSE 0 END)HIRED_81 SUM(CASE WHEN INSTR(HIREDATE '80') > 0 THEN 1 ELSE 0 END)HIRED_80 SUM(CASE WHEN INSTR(HIREDATE '87') > 0 THEN 1 ELSE 0 END)HIRED_87 SUM(CASE WHEN INSTR(HIREDATE '82') > 0 THEN 1 ELSE 0 END)HIRED_82 FROM EMP /
This query is as per ORACLE 9I EMP table that I have in my home.
RE: create a query that will display the total no.of employees and, of that total, the no.of employees hired in 1995,1996,1997, and 1998. create appropriate column headings.
select count(*) Count to_char(hiredate 'YYYY') YEAR from emp group by to_char(hiredate 'YYYY') having substr(to_char(hiredate 'yyyy') -1) in(5 6 7 8)