Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Very simple subqueries
Subqueries with multiple results
12. The SOME operator
Correlated subqueries
Other subqueries

Instruction

Great. Instead of ANY you can also use SOME. Take a look:

SELECT
  *
FROM Trip
WHERE Trip.Price < SOME (
  SELECT
    HikingTrip.Price
  FROM HikingTrip
  WHERE HikingTrip.MountainID = 1
);

SOME works in the same way as ANY and you can use them interchangeably.

Just as with ANY, other logical operators are possible: = SOME, != SOME, > SOME, <= SOME, >= SOME.

Exercise

Change the template (the answer from the last exercise) so it uses SOME instead of ANY.

Stuck? Here's a hint!

Type:

SELECT
  *
FROM Trip
WHERE Trip.Price = SOME (
  SELECT
    HikingTrip.Price
  FROM HikingTrip
);