Your question is SQL Top-N Query. Start with the requirements and the one table 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.
Hitachi Energy wants a quick view of which products generate the most recorded sales. Use the product sales data to identify the five highest-selling products.
Write a PostgreSQL query that calculates total sales for each product and returns the top five products.
product_name is NULL because they cannot be attributed to a product.| Column | Type | Description |
|---|---|---|
| sale_idPK | INTEGER | Unique sale record identifier |
| product_name | VARCHAR(100) | Hitachi Energy product name |
| sales_amount | NUMERIC(12,2) | Recorded sales amount |