Professional Documents
Culture Documents
ANY and ALL keywords are used with a WHERE or HAVING clause.
ANY and ALL operate on subqueries that return multiple values.
ANY returns true if any of the subquery values meet the condition.
ALL returns true if all of the subquery values meet the condition.
1. SELECT column-names
2. FROM table-name
3. WHERE column-name operator ANY
4. (SELECT column-name
5. FROM table-name
6. WHERE condition)
1. SELECT column-names
2. FROM table-name
3. WHERE column-name operator ALL
4. (SELECT column-name
5. FROM table-name
6. WHERE condition)
PRODUCT
Id
ProductName
SupplierId
UnitPrice
Package
IsDiscontinued
ORDERITEM
Id
OrderId
ProductId
UnitPrice
Quantity
1. SELECT ProductName
2. FROM Product
3. WHERE Id = ANY
4. (SELECT ProductId
5. FROM OrderItem
6. WHERE Quantity = 1)
Results: 17 records
ProductName
Ikura
Konbu
Tofu
CUSTOMER
Id
FirstName
LastName
City
Country
Phone
ORDER
Id
OrderDate
OrderNumber
CustomerId
TotalAmount
Results: 22 records
CustomerName
Art Braunschweiger
Christina Berglund
Elizabeth Lincoln
Frédérique Citeaux
Georg Pipps
Horst Kloss
Howard Snyder