bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL EXISTS Keyword

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind SQL EXISTS 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.

___ SupplierName
3Order

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

The following SQL lists the suppliers with a product price equal to 22:
The following SQL lists the suppliers with a product price less than 20:
The EXISTS command tests for the existence of any record in a subquery, and returns true if the subquery returns one or more records.

Exists

The EXISTS command tests for the existence of any record in a subquery, and returns true if the subquery returns one or more records.

The following SQL lists the suppliers with a product price less than 20:

Example

  SELECT SupplierName
FROM Suppliers
WHERE EXISTS (SELECT ProductName FROM
  Products WHERE SupplierId = Suppliers.supplierId AND Price < 20);

The following SQL lists the suppliers with a product price equal to 22:

Example

  SELECT SupplierName
FROM Suppliers
WHERE EXISTS (SELECT ProductName FROM
  Products WHERE SupplierId = Suppliers.supplierId AND Price = 22);

Previous

SQL EXEC Keyword

Next

SQL FOREIGN KEY Keyword