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.

Showing Answers 1 - 11 of 11 Answers

mano

  • Sep 27th, 2006
 

Hi ,

U can use with the help of Decode fn.

  Was this answer useful?  Yes

hafeez

  • Oct 4th, 2006
 

select count(*),to_char(hiredate,'yyyy') from emp  group by to_char(hiredate,'yyyy')

  Was this answer useful?  Yes

dustlove

  • Aug 22nd, 2007
 

Like this:
select count(*), count(decode(to_char(hire_date, 'yyyy'),'1995', 1, null)) y1995,
       count(decode(to_char(hire_date, 'yyyy'),'1996', 1, null)) y1996 from co_counter 

emraan

  • Dec 28th, 2009
 

select count(*)"Total Employees", count(decode(to_char(hiredate, 'yyyy'),1981,1)) "Year - 1981", count(decode(to_char(hiredate, 'yyyy'),1982,1)) "Year - 1982", count(decode(to_char(hiredate, 'yyyy'),1983,1)) "Year - 1983" from emp


kishorekumar522

  • Jul 19th, 2011
 

Two ways

Code
  1. span style="color: #ff0000;">'yyyy'),'1995''yyyy'),'1996''yyyy'),

  2. '1997''yyyy'),'1998''yyyy''yyyy''1995','1996','1997','1998''yyyy'

  Was this answer useful?  Yes

hussain

  • Jul 26th, 2011
 

select * from employees where hiredate =#1995,1996,1997,1998#;

  Was this answer useful?  Yes

Arjun Bansal

  • Oct 1st, 2011
 

select count(*)"Total Employees", count(decode(to_char(hiredate, 'yyyy'),1981,1)) "Year - 1981", count(decode(to_char(hiredate, 'yyyy'),1982,1)) "Year - 1982", count(decode(to_char(hiredate, 'yyyy'),1983,1)) "Year - 1983" from emp


  Was this answer useful?  Yes

Prashanth

  • Oct 10th, 2011
 

Exact query you required..... Try it out if you have any doubts.

Code
  1. span style="color: #ff0000;">'yyyy''yyyy''yyyy');

  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