Your question is Top-Performing Products Query. Start with the requirements and the two 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.
Tesco's commercial team wants to identify the best-performing products in a specific quarter using product sales data.
Write a PostgreSQL query that returns the top three Tesco products by revenue for Q2 2025, from 1 April through 30 June 2025.
quantity * unit_price for revenue.| Column | Type | Description |
|---|---|---|
| product_idPK | INTEGER | Unique product identifier |
| product_name | VARCHAR(150) | Tesco product name |
| category | VARCHAR(80) | Product category |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INTEGER | Unique sale identifier |
| product_id | INTEGER | Product sold, referencing products.product_id |
| sale_date | DATE | Date on which the sale occurred |
| quantity | INTEGER | Number of units sold |
| unit_price | NUMERIC(10,2) | Selling price per unit |