Your question is Top 10 Customers SQL. Start with the requirements and the one table 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.
Healthfirst Marketplace tracks member purchases in a transaction ledger. The analytics team needs the ten customer accounts with the highest cumulative purchase value.
Write a PostgreSQL query against member_purchase_transactions to return the top 10 customers by total purchase amount.
customer_name and calculate each customer's total purchase amount.customer_name as a secondary ascending sort for deterministic ordering.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique identifier for a marketplace purchase transaction. |
| customer_name | VARCHAR(100) | Name of the Healthfirst Marketplace customer account. |
| purchase_amount | NUMERIC(12,2) | Recorded purchase value. NULL represents an unpriced pending adjustment. |
| purchase_date | DATE | Date the transaction was recorded. |