Average price by category above 1300 (price 200–3500)
Level: Junior50 XP
Instructions
Among the products with a price from 200 to 3500 inclusive, compute for each category (category_id) the number of products products_cnt and the average price avg_price, rounded to 2 decimal places. Keep the categories where the unrounded average price is strictly greater than 1300. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Exactly oneZero or oneZero or more
Table relationships
- N:1Many-to-one
order_items.→order_id orders.id - N:1Many-to-one
order_items.→product_id products.id - N:1Many-to-one
orders.→customer_id customers.id - N:1Many-to-one
products.→category_id categories.id
Table data
PostgreSQL
Select a table in the diagram or list to view its rows.