Write a query to find the top three performing categories in a sales dataset.
Use the provided categories and sales tables. Performance is measured by total sale amount. Include categories with no matching sales as zero, and exclude sales that cannot be associated with a category.
category_name and total_sales.total_sales descending, then category_name ascending to break ties.| Column | Type | Description |
|---|---|---|
| category_idPK | INT | Unique category identifier |
| category_name | VARCHAR(100) | Category name |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| category_id | INT | Category associated with the sale |
| sale_amount | NUMERIC(12,2) | Amount recorded for the sale |