Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

ANY

ANY

The ANY command returns true if any of the values in the subquery meet the condition.

The subsequent SQL statement returns TRUE and lists the product names if it finds any records in the OrderDetails table where the quantity is equal to 10.

Example

SELECT ProductName
FROM Products
WHERE ProductID = ANY (SELECT ProductID FROM OrderDetails WHERE Quantity = 10); 

The provided SQL statement returns TRUE and lists the product names if it finds any records in the OrderDetails table where the quantity exceeds 99.

Example

SELECT ProductName
FROM Products
WHERE ProductID = ANY (SELECT ProductID FROM OrderDetails WHERE Quantity > 99);