Junior Dates SQL & Databases

Write a query to find employees hired in the last 30 days.

Short answer: Filter HireDate >= DATEADD(DAY, -30, CAST(GETDATE() AS date)). Prefer sargable predicates — avoid wrapping the column in functions when possible.

Sample solution

T-SQL
SELECT EmpId, Name, HireDate
FROM Employees
WHERE HireDate >= DATEADD(DAY, -30, CAST(SYSUTCDATETIME() AS date));
Mention SYSUTCDATETIME vs GETDATE and time-zone awareness for global apps.
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details