Your question is Rank Customers by Monthly Usage. 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.
Write a SQL query to rank customers by monthly usage within each region at Viasat.
Use the provided customer and usage data. Include only customers with an assigned region and recorded usage, and treat a month as the calendar month of each usage record.
region, usage_month, customer_id, customer_name, monthly_usage, and usage_rank.region, usage_month, usage_rank, and customer_id.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| region | VARCHAR(50) | Assigned Viasat service region |
| Column | Type | Description |
|---|---|---|
| usage_idPK | INT | Unique usage record identifier |
| customer_id | INT | Customer associated with the usage record |
| usage_date | DATE | Date on which usage occurred |
| usage_units | NUMERIC(12,2) | Usage amount recorded for the customer |