Module 4 ยท Dates, windows and time Lesson 10 of 15
Dates and time in SQL
Dates are the most common filter in analytics and the one most often broken. Store them as real date columns, filter with ranges, and never compare a date to a string that only looks like one.
Worked example
WHERE created_at >= '2026-01-01' AND created_at < '2026-02-01' covers a whole month and still lets the database use an index on the column.
Your practice task
Count postings per month for the last six months, then count only the last seven days, and compare the two queries.
Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.
Key takeaway
Dates are the most common filter in analytics and the one most often broken. Store them as real date columns, filter with ranges, and never compare a date to a string that only looks like one.
Keep your place in this course
A free account saves which lessons you have finished and unlocks the certificate. The lesson itself stays free to read.
Create free account or sign inCourse complete
You finished every lesson.
Your certificate is ready, and the projects you built are the proof to attach to an application.
Almost there
15 lessons left of 15
Finish every lesson to unlock the certificate. Each one ends in a practice task โ do them and the final project brief writes itself.