Interview Guides
NovaCart wants a simple monthly sales summary from a single transactions table. Write a SQL query to aggregate completed sales for January 2024 by product category.
category, transaction_count, and total_sales for rows where status = 'completed' and transaction_date is in January 2024.category and order by total_sales descending.transactions
| column_name | type | description |
|---|---|---|
| id | INT | Unique transaction ID |
| category | VARCHAR(50) | Product category |
| amount | DECIMAL(10,2) | Transaction amount |
| status | VARCHAR(20) | Transaction status |
| transaction_date | DATE | Date of transaction |
| sales_rep | VARCHAR(100) | Sales representative name |