Your question is Optimize Complex Query for Compute Efficiency. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A data analytics team at Acme Corp is facing high compute costs due to a complex SQL query that aggregates sales data across multiple tables. Write a SQL query that optimizes the original query to minimize resource consumption while still delivering the required results.
| Column | Type | Description |
|---|---|---|
| idPK | INT | Primary key |
| category_id | INT | Foreign key referencing categories |
| amount | DECIMAL(10,2) | Transaction amount |
| transaction_date | DATE | Date of transaction |
| Column | Type | Description |
|---|---|---|
| idPK | INT | Primary key |
| name | VARCHAR(255) | Category name |
| Column | Type | Description |
|---|---|---|
| idPK | INT | Primary key |
| name | VARCHAR(255) | Customer name |
| signup_date | DATE | Date of customer signup |