How can we measure the duration or difference between two dates in days?
DATEDIFF calculates the count of interval units between two date timestamps.
Customer retention duration, employee tenure, ticket resolution time, shipping delays.
SELECT
name,
DATEDIFF(
CURRENT_DATE,
join_date
) AS days_worked
FROM employees;Practice typing production-grade SQL code for DATEDIFF.