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
9498
7609
8481
8628
7497
9865
9528
8502
10598
8777
7316
6931
7862
7085

Discussion

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

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

Progress

Proceed to Next step