7. Handling Dates: Step 6

Demo

To compute date intervals.

Date intervals - the interval of time between two dates. How many days has each employee worked?

SQL

SELECT to_days(current_date) - to_days(hiredate) as "Days Worked" FROM emp;

Output

Days Worked
9381
7492
8364
8511
7380
9748
9411
8385
10481
8660
7199
6814
7745
6968

Discussion

[Access] SELECT date() - hiredate FROM emp;

[Oracle] SELECT trunc(sysdate - hiredate) FROM emp;

Progress

Proceed to Next step