Skip to main content
All Problems
hard0% acceptance

Rank Customers by Order Value with RANK and DENSE_RANK

For each order, rank customers by total_amount using both RANK() and DENSE_RANK(). Return customer_id, order_date, total_amount, the RANK value, and the DENSE_RANK value. Order by total_amount descending.

Schema

🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute