Quantiphi's commerce analytics team needs category-level sales benchmarks for product performance reporting. Categories with no completed sales should remain visible for dashboard completeness.
Write a PostgreSQL query that calculates the average completed sale value for each product category during Q1 2025. A sale's value is quantity * unit_price.
products to sales by product_id and retain categories with no qualifying sales.completed and a sale date from 2025-01-01 through 2025-03-31.| Column | Type | Description |
|---|---|---|
| product_idPK | INTEGER | Unique product identifier |
| product_name | VARCHAR(100) | Product name |
| category | VARCHAR(50) | Product category |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INTEGER | Unique sale identifier |
| product_id | INTEGER | Product associated with the sale |
| sale_date | DATE | Date on which the sale occurred |
| status | VARCHAR(20) | Sale processing status |
| quantity | INTEGER | Number of units sold |
| unit_price | NUMERIC(10,2) | Price for one unit |