CGI's retail reporting team needs a monthly view of its best-selling products. Write a PostgreSQL query that ranks products by units sold from completed orders.
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| order_date | DATE | Date on which the order was placed |
| status | VARCHAR(20) | Order lifecycle status |
| Column | Type | Description |
|---|---|---|
| order_item_idPK | INTEGER | Unique order line identifier |
| order_id | INTEGER | References orders.order_id |
| product_id | INTEGER | References products.product_id |
| quantity | INTEGER | Number of units on the order line |
| Column | Type | Description |
|---|---|---|
| product_idPK | INTEGER | Unique product identifier |
| product_name | VARCHAR(100) | Display name of the product |
| category | VARCHAR(50) | Product category |