SQL Flow Field Guide

EXISTS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

TRUE when the subquery returns any row (NOT EXISTS = anti-semi-join)

What changes

Input
outer row value and a subquery result
Output or change
TRUE, FALSE or UNKNOWN per outer row
Return type
Boolean

Syntax at a glance

EXISTS ( subquery )

Work example

A report needs EXISTS to define which rows satisfy a compound search condition.

Test a match, a nonmatch, and NULL. Write the expected TRUE, FALSE, or UNKNOWN result before running the filter.

Check your work EXISTS. The rows kept by EXISTS are exactly those whose complete condition evaluates to TRUE.

Practice SQL

Open in SQL Flow
SELECT N'alpha' AS Label WHERE EXISTS (SELECT 1 FROM (VALUES (1)) AS Match(Value));

Open Microsoft Learn for full syntax, permissions, and details for your version.