SQL Keyword ALL

The ALL keyword returns TRUE if all of the subquery values meet the condition

The below SQL returns a product record, whose product ID is equal to all the product IDs returned by the inner query.

  • The inner query must return one or more product IDs, and all of them must be the same.
SELECT * FROM products
WHERE product_id = ALL (SELECT product_id FROM order_details WHERE quantity = 10);

Related Links