Skip to main content
All Problems
hard0% acceptance

Customers Who Bought from Every Category

Find customers who have purchased products from more than 12 different categories. Return the customer's first name, last name, and the number of distinct categories they bought from as categories_bought. Sort by categories_bought descending, then by last name.

Schema

🔑idINT
first_nameTEXT
last_nameTEXT
emailTEXT
phoneTEXTNULL
cityTEXT
stateTEXT
countryTEXT
created_atTIMESTAMP
postgresql

Run your query to see results

Press Ctrl + Enter to execute