Write a SQL query to find the total sales for each product category in the last quarter.
Use the calendar quarter immediately preceding CURRENT_DATE. Include categories with no qualifying sales and report their total as zero.
category_name and total_sales.total_sales descending, then category_name ascending to break ties.| Column | Type | Description |
|---|---|---|
| category_idPK | INT | Unique product category identifier |
| category_name | VARCHAR(100) | Product category name |
| Column | Type | Description |
|---|---|---|
| product_idPK | INT | Unique product identifier |
| product_name | VARCHAR(150) | Product name |
| category_id | INT | Category assigned to the product |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| product_id | INT | Product sold |
| sale_date | DATE | Date of the sale |
| quantity | INT | Number of units sold |
| unit_price | NUMERIC(10,2) | Price per unit |