Your question is Compute Running Totals in 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.
Caterpillar operations analysts need a chronological view of completed equipment shipments from active manufacturing plants. Write a PostgreSQL query that calculates daily shipped units and a running total for each active plant.
shipment_events to plants and include only active plants.completed within January 2025.| Column | Type | Description |
|---|---|---|
| plant_idPK | INTEGER | Unique manufacturing plant identifier |
| plant_name | VARCHAR(100) | Caterpillar manufacturing plant name |
| region | VARCHAR(50) | Operating region |
| is_active | BOOLEAN | Whether the plant is active |
| Column | Type | Description |
|---|---|---|
| shipment_idPK | INTEGER | Unique shipment event identifier |
| plant_id | INTEGER | Manufacturing plant associated with the event |
| shipment_date | DATE | Shipment activity date |
| units_shipped | INTEGER | Number of units shipped |
| status | VARCHAR(20) | Shipment processing status |