SQL data engineering interview problem. Difficulty: intermediate. Pattern: Date Functions. About 12 minutes. Part of the Pro drill bank.
For each employee, compute days between hire_date and DATE '2026-01-01' (do not use CURRENT_DATE). Columns: name, hire_date, days_employed. Order by days_employed descending, then name.
Input: name | hire_date Omar Ali | 2020-06-01 Eve Ng | 2024-01-05 Output: name | hire_date | days_employed Omar Ali | 2020-06-01 | 2040 Eve Ng | 2024-01-05 | 727 Why this passes: As-of date is fixed at 2026-01-01 so grading stays deterministic.
Topics: lakebench, sql, dates, datediff.
More SQL interview questions · All interview problems · Learn data engineering
Interview-style drill: Days between hire_date and a fixed as-of date.
For each employee, compute days between `hire_date` and DATE '2026-01-01' (do not use CURRENT_DATE). Columns: `name`, `hire_date`, `days_employed`. Order by `days_employed` descending, then `name`.