# SQL EXISTS Operator

### The SQL EXISTS Operator

The EXISTS operator is used to test for the existence of any record in a subquery.

The EXISTS operator returns true if the subquery returns one or more records.

#### EXISTS Syntax

```sql
SELECT column_name(s)
FROM table_name
WHERE EXISTS
(SELECT column_name FROM table_name WHERE condition);
```

### Demo Database

Below is a selection from the "Products" table :\


![](https://826093633-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS8lPNzCGPR5-DLbGXv%2F-LSc7Hbuv-Nzad-xzPSA%2F-LSc7WufR5dOEcrlWEgG%2Fimage.png?alt=media\&token=b1723bf4-87a7-42d4-b884-a8e2284ba841)

And a selection from the "Suppliers" table:

![](https://826093633-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS8lPNzCGPR5-DLbGXv%2F-LSc7Hbuv-Nzad-xzPSA%2F-LSc7cCztcgTYobEhvMO%2Fimage.png?alt=media\&token=65076b8a-32d5-46c4-9bfe-779265188d93)

**SQL EXISTS Examples**

The following SQL statement returns TRUE and lists the suppliers with a product price less than 20:

```
SELECT SupplierName
FROM Suppliers
```

&#x20;The following SQL statement returns TRUE and lists the suppliers with a product price equal to 22:

```
SELECT SupplierName
FROM Suppliers
```
