Skip to main content
All Problems
medium0% acceptance

Customer Count by Age Group

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.

Schema

🔑idINT
first_nameTEXT
last_nameTEXT
emailTEXT
phoneTEXTNULL
date_of_birthTEXT
cityTEXT
stateTEXT
countryTEXT
created_atTIMESTAMP
postgresql

Run your query to see results

Press Ctrl + Enter to execute