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
9625
7736
8608
8755
7624
9992
9655
8629
10725
8904
7443
7058
7989
7212

Discussion

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

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

Progress

Proceed to Next step