Domo's Data Analyst team wants a monthly view of the products generating the most revenue. Write a PostgreSQL query that calculates product revenue from order line items and returns the top three products for each calendar month.
completed.quantity * unit_price, grouped by month and product.product_id.| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Order identifier |
| order_date | DATE | Date the order was placed |
| status | VARCHAR(20) | Order processing status |
| Column | Type | Description |
|---|---|---|
| order_item_idPK | INT | Line item identifier |
| order_id | INT | References orders.order_id |
| product_id | INT | References products.product_id |
| quantity | INT | Number of units purchased |
| unit_price | NUMERIC(10,2) | Price per unit at purchase time |
| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Product identifier |
| product_name | VARCHAR(100) | Domo product name |
| category | VARCHAR(50) | Product category |