Each Customer's Second-Largest Order

medium
Unit 16 · Window Functions IX0/2 to milestone

For customers with at least two orders, return customer_id and second_largest: the second-highest distinct order total. If all their orders have the same total, leave them out. Sort by customer_id.

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
Each Customer's Second-Largest Order · TechGradify