查询Oracle scott方案 emp表中工龄大于3年的员工人数,请写出查询语句

解决方案 »

  1.   

    select count(*) from scott.emp where (sysdate-hiredate)>3
      

  2.   

    --简单粗约的
    select count(*) from scott.emp where (sysdate-hiredate)/365.0>3 
      

  3.   

    没那么麻烦
    month_between(hiredate,sysdate)/12 > 3
      

  4.   

    select count(*) from scott.emp where hiredate<add_months(sysdate,-36)
      

  5.   

    select * from scott.emp where month_between(hiredate,sysdate)>=36;