Your question is SQL: Top 5 Customers by Value. 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.
Myntra's Business Analytics team wants to identify its highest-value customers for the previous completed calendar quarter. Write a PostgreSQL query using the customers and orders tables.
CURRENT_DATE.cancelled.customer_id as a deterministic tie-breaker.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique Myntra customer identifier |
| customer_name | VARCHAR(100) | Customer's display name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| customer_id | INTEGER | Customer who placed the order |
| order_date | DATE | Date on which the order was placed |
| order_value | NUMERIC(12,2) | Gross monetary value of the order |
| status | VARCHAR(20) | Current order status |