Use the keyword ANY (or its synonym SOME) before a subquery
to determine whether a comparison is true for at least one of the
values returned. If the subquery returns no values, the search condition
is false. (Because no values exist, the condition cannot be
true for one of them.)
The following query finds the order number
of all orders that contain an item for which the total price is greater
than the total price of any one of the items in order number 1005. Figure 1: Query
SELECT DISTINCT order_num
FROM items
WHERE total_price > ANY
(SELECT total_price
FROM items
WHERE order_num = 1005);