Your question is Month-over-Month Sales SQL. 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.
Daimler Truck North America wants to monitor monthly truck sales performance across sales regions and identify regional increases or declines.
Write a PostgreSQL query that compares monthly truck sales by region from January through April 2024.
truck_sales to regions using region_id.LAG to return the prior available month’s sales for each region.NULL for percentage change.| Column | Type | Description |
|---|---|---|
| region_idPK | INT | Unique sales region identifier |
| region_name | VARCHAR(50) | Daimler Truck sales region name |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique truck sale identifier |
| region_id | INT | Region associated with the sale |
| sale_date | DATE | Date on which the sale was recorded |
| sale_amount | NUMERIC(12,2) | Sale value in US dollars |