Practice Interview Questions
| Question | Status |
|---|---|
Write a query to identify the top highest-grossing products within each category in 2022. Your output should include the category and the top product for each category. Assume there are no sales ties between products within the same category.
product_spend table:
| Column Name | Description |
|---|---|
| category | The category of the product |
| product | Name of the product |
| user_id | User ID who made the transaction |
| spend | Amount spent on the transaction |
| transaction_date | Date the transaction occurred |
Write a query to identify the top highest-grossing products within each category in 2022. Your output should include the category and the top product for each category. Assume there are no sales ties between products within the same category.
product_spend table:
| Column Name | Description |
|---|---|
| category | The category of the product |
| product | Name of the product |
| user_id | User ID who made the transaction |
| spend | Amount spent on the transaction |
| transaction_date | Date the transaction occurred |
| category | product |
|---|---|
| Electronics | Laptop |
| Home | Bed |
| category | product |
|---|---|
| Electronics | Laptop |
| Home | Bed |