Your question is Top Products by Monthly Volume. 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.
DHL Supply Chain needs a monthly view of which products generate the highest shipment volume. Write a PostgreSQL query that ranks products within each calendar month using completed shipment quantities.
quantity by month and product.status = 'Completed'.ROW_NUMBER() and ordering ties alphabetically by product name.| Column | Type | Description |
|---|---|---|
| shipment_idPK | INT | Unique shipment identifier |
| product_id | INT | Product associated with the shipment |
| shipment_date | DATE | Date on which the shipment was recorded |
| quantity | INT | Number of product units shipped |
| status | VARCHAR(20) | Shipment processing status |
| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Unique product identifier |
| product_name | VARCHAR(100) | Product name |
| product_category | VARCHAR(50) | Product classification |