Chapter 4 · Aggregations
58. Customer Count by Age Group
Medium20 XPFinance
The marketing team wants to segment customers by age group. Using date_of_birth, classify customers into groups: 'Under 30', '30-49', '50-69', '70+'. Return age_group and customer_count. Sort by customer_count descending. Use '2025-01-01' as the reference date.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- phoneTEXT
- date_of_birthTEXT
- cityTEXT
- stateTEXT
- countryTEXT
- created_atTIMESTAMP
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.