SQL Quest › SQL Interview Questions › Date Functions
Customer Signup Quarter (Date + CASE)
A cohort analyst wants every customer labeled by signup quarter (Q1–Q4) for time-series cohort grids.
Show customer_id, name, signup_date, and quarter ('Q1' for months 01–03, 'Q2' for 04–06, 'Q3' for 07–09, 'Q4' for 10–12). Order by signup_date.
The pattern: strftime('%m', signup_date) returns a 2-char month string, then a CASE expression buckets it. Quarter math feels trivial but it's one of the most repeated reporting patterns in business SQL.
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
customers
| customer_id | name | signup_date | membership | total_orders | |
|---|---|---|---|---|---|
| 1 | John Smith | john.smith@email.com | 2023-01-15 | Gold | 15 |
| 2 | Emma Wilson | emma.wilson@email.com | 2023-03-20 | Silver | 8 |
| 3 | Michael Brown | michael.brown@email.com | 2023-02-10 | Gold | 12 |
Expected output: quarter = 'Q2'
Hint
Concepts
SELECT Date Functions strftime CASE
Practise the topic: SQL practice questions · Date function practice · CASE WHEN practice
In these company practice sets
A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.
Related questions
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test