Kodewick
Start learning →
Basic←→0 / 70

Above average

#060BasicSubqueriesAggregates4 min

The shop wants to see which things cost more than average. Pick the products whose price is above the average price of all products, with name and price. Work the average out with a query; don't type it in.

The tables
products
idnamecategorypricestock
1Milk teadrink1230
2Lemon waterdrink850
3Cheesecakecake256
4Cookiesnack580
5Browniecake180
6Iced coffeedrink1520
7Chipssnack740
8Fruit tartcake284
8 rows
query.sql
SELECT name, price
FROM products
WHERE price > (
  -- your code here: inside the brackets, a query that works out AVG(price)
);
Ctrl + Enter runs too
Result

Run shows what your query gives. When it looks right, Submit.