bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL ANY Keyword

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind SQL ANY Keyword?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ ProductName
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The following SQL statement returns TRUE and lists the productnames if it finds ANY records in the OrderDetails table where quantity > 99:
The following SQL statement returns TRUE and lists the productnames if it finds ANY records in the OrderDetails table where quantity = 10:
The ANY command returns true if any of the subquery values meet the condition.

Any

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

The following SQL statement returns TRUE and lists the productnames if it finds ANY records in the OrderDetails table where quantity = 10:

Example

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

The following SQL statement returns TRUE and lists the productnames if it finds ANY records in the OrderDetails table where quantity > 99:

Example

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

Previous

SQL AND Keyword

Next

SQL AS Keyword