Oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cpkrishnas
    New Member
    • Jul 2007
    • 2

    Oracle

    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.
  • prakash331
    New Member
    • Jul 2007
    • 5

    #2
    Originally posted by cpkrishnas
    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.

    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;

    Comment

    • geethika81
      New Member
      • Oct 2007
      • 1

      #3
      Originally posted by cpkrishnas
      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.

      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

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Originally posted by cpkrishnas
        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.
        Kindly post what you have tried so far.

        We are not here to do your homework.

        Comment

        Working...