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
9443
7554
8426
8573
7442
9810
9473
8447
10543
8722
7261
6876
7807
7030

Discussion

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

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

Progress

Proceed to Next step