create a query that will display the total number of employees and, of that total, the number of employees hired in 1995,1996,1997 and 1998. Create apprppriate column headings.
Oracle
Collapse
X
-
Tags: None
-
Originally posted by cpkrishnascreate a query that will display the total number of employees and, of that total, the number of employees hired in 1995,1996,1997 and 1998. Create apprppriate column headings.
select
select count(*) from emp where hire_date between to_date('01-01-1995',dd-mm-yyyy) and to_date('31-12-1995',dd-mm-yyyy) "Employees Hired in 1995",
select count(*) from emp where hire_date between to_date('01-01-1996',dd-mm-yyyy) and to_date('31-12-1996',dd-mm-yyyy) "Employees Hired in 1996",
select count(*) from emp where hire_date between to_date('01-01-1997',dd-mm-yyyy) and to_date('31-12-1997',dd-mm-yyyy) "Employees Hired in 1997",
select count(*) from emp where hire_date between to_date('01-01-1998',dd-mm-yyyy) and to_date('31-12-1998',dd-mm-yyyy) "Employees Hired in 1998",
Select count(*) from emp "Total Number Of Employees" from emp; -
Originally posted by cpkrishnascreate a query that will display the total number of employees and, of that total, the number of employees hired in 1995,1996,1997 and 1998. Create apprppriate column headings.
Tey this
select distinct
(select count(*) from emp where hiredate like '%95') "1995"
,(select count(*) from emp where hiredate like '%96') "1996"
,(select count(*) from emp where hiredate like '%97') "1997"
,(select count(*) from emp where hiredate like '%98') "1998"
,(select count(*) from emp) "total"
from emp
group by hiredate;Comment
-
Originally posted by cpkrishnascreate a query that will display the total number of employees and, of that total, the number of employees hired in 1995,1996,1997 and 1998. Create apprppriate column headings.
We are not here to do your homework.Comment
Comment