Write a query to identify products with the maximum discount per category, using the PRODUCT and PURCHASE tables.
Consider only products that appear in product at least once in purchase. Products with a NULL discount are ignored. If multiple products share the maximum discount in a category, return all of them.
product_id, product_name, category, and discount_percentage.category, then product_id ascending.| Column | Type | Description |
|---|---|---|
| product_idPK | INTEGER | Unique product identifier |
| product_name | VARCHAR(100) | Product name |
| category | VARCHAR(50) | Product category |
| discount_percentage | NUMERIC(5,2) | Discount percentage offered on the product |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INTEGER | Unique purchase identifier |
| product_id | INTEGER | Purchased product identifier |
| purchase_date | DATE | Date of purchase |
| quantity | INTEGER | Number of units purchased |