Your question is SQL Top N 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.
Sense wants to identify its highest-value customers using completed orders recorded in its platform. Write a PostgreSQL query to return the top 3 customers by revenue during Q1 2025.
customer_id.completed and an order_date from 2025-01-01 through 2025-03-31.customer_name as a deterministic tie-breaker.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| account_status | VARCHAR(20) | Current customer account status |
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| customer_id | INTEGER | Customer associated with the order |
| order_date | DATE | Date the order was created |
| status | VARCHAR(20) | Order processing status |
| order_total | NUMERIC(12,2) | Revenue attributed to the order |