Your question is SQL Top 5 Customers by Revenue. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Confluent's customer analytics team needs a ranked view of its highest-revenue customers. Assuming the reporting date is January 1, 2026, write a PostgreSQL query to find the top five customers by completed-order revenue during the previous calendar year, January 1 through December 31, 2025.
status = 'completed' and an order_date in the 2025 calendar year.customers and aggregate revenue by customer.customer_id as a deterministic tie-breaker.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer or organization name |
| segment | VARCHAR(30) | Customer segment |
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| customer_id | INTEGER | Customer associated with the order |
| order_date | DATE | Date the order was placed |
| status | VARCHAR(20) | Order processing status |
| total_amount | NUMERIC(12,2) | Order revenue amount |