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
9680
7791
8663
8810
7679
10047
9710
8684
10780
8959
7498
7113
8044
7267

Discussion

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

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

Progress

Proceed to Next step