Octane wants to identify which products generate the highest sales volume. Write a PostgreSQL query that ranks products by the total number of units sold in completed orders.
status = 'completed'.quantity by product, preserving products with no qualifying sales.product_id ascending as the tie-breaker.| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Unique product identifier |
| product_name | VARCHAR(100) | Product display name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| status | VARCHAR(20) | Current order status |
| Column | Type | Description |
|---|---|---|
| order_id | INT | Order containing the item |
| product_id | INT | Product included in the order line |
| quantity | INT | Number of units on the order line |