Customer Spend Quartiles with NTILE

medium
Unit 11 · Window Functions IV0/3 to milestone

Segment customers into four tiers by total spend. Return name, total_spent and quartile (1 = biggest spenders) using NTILE(4) over customers who have ordered, ordered by total spend descending with ties by name. Sort the output by quartile, then name.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
query.sql · SQLite
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Customer Spend Quartiles with NTILE · TechGradify