7. Handling Dates: Step 2

Demo

Comparing dates

To list all employees who were hired before 1 jan 1996:

SQL

SELECT * FROM emp WHERE hiredate < '96-01-01';

Output

empno ename job mgr hiredate sal comm deptno
7369 SMITH CLERK 7902 1993-06-13 800.00 0.00 20
7566 JONES MANAGER 7839 1995-10-31 2975.00 20
7698 BLAKE MANAGER 7839 1992-06-11 2850.00 30
7782 CLARK MANAGER 7839 1993-05-14 2450.00 10
7839 KING PRESIDENT 1990-06-09 5000.00 0.00 10
7844 TURNER SALESMAN 7698 1995-06-04 1500.00 0.00 30

Discussion

[Access] SELECT * FROM emp WHERE hiredate < #1-jan-96#;

[Oracle] SELECT * FROM emp WHERE hiredate < '1-jan-96';

Progress

Proceed to Next step