Results 1 to 4 of 4

Thread: begin with sql

  1. #1
    Join Date
    Jun 2003
    Posts
    4

    Unanswered: begin with sql

    I'm beging with oracle, anyone hepl me write sql command:Find the employees who were hired more than 12 years ago. (data in table emp).
    Thank!

  2. #2
    Join Date
    May 2003
    Posts
    12
    select * from emp where doj<=sysdate-4380

    12 yrs * 365 = 4380

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Originally posted by rag_kris
    select * from emp where doj<=sysdate-4380

    12 yrs * 365 = 4380
    That's close, but not accurate due to leap years:

    SQL> select sysdate, sysdate-4380 from dual;

    SYSDATE SYSDATE-438
    ----------- -----------
    05-JUN-2003 08-JUN-1991

    This is exact:

    SQL> select sysdate, add_months(sysdate,-144) from dual;

    SYSDATE ADD_MONTHS(
    ----------- -----------
    05-JUN-2003 05-JUN-1991

  4. #4
    Join Date
    Jun 2003
    Posts
    4
    Originally posted by rag_kris
    select * from emp where doj<=sysdate-4380

    12 yrs * 365 = 4380
    Thank for your hepl!
    I wish you feel so happy!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •