On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Very simple subqueries
7. Subqueries with functions
Subqueries with multiple results
Correlated subqueries
Other subqueries


Nice! Next thing, our subqueries can become more complicated if we include some functions in them. Take a look:

FROM hiking_trip
WHERE length < (
  SELECT AVG(length)
  FROM hiking_trip

Now our query looks for all hiking trips with a distance less than the average. As you can see, we used the function AVG() in the subquery which, as you might remember, gives us the average value from a column.


Find all information about trips whose price is higher than the average.

Stuck? Here's a hint!


FROM trip
WHERE price > (
  SELECT AVG(price)
  FROM trip