Spring Deals - hours only!Up to 70% off on all courses and bundles.-Close
Very simple subqueries
Subqueries with multiple results
Correlated subqueries
18. The operator ANY in correlated subqueries
Other subqueries


Okay! One more thing - you can also use the operator ANY in your correlated subqueries. Just take a look:

FROM hiking_trip 
WHERE price < ANY (
  SELECT price FROM trip 
  WHERE trip.days = hiking_trip.days

The above query compares city trips and hiking trips which last the same number of dates. It then returns all hiking trips which are cheaper than any city trip of the same duration time.


Select those trips which last shorter than any hiking_trip with the same price.

Stuck? Here's a hint!


FROM trip 
WHERE days < ANY (
  SELECT days FROM hiking_trip 
  WHERE trip.price = hiking_trip.price