📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

EXISTS



The exists condition is used in combination with a subquery and is considered "to be met" if the subquery returns at least one row.

Syntax

WHERE EXISTS ( <subquery> );

Examples

SELECT number FROM numbers(5) AS A WHERE exists (SELECT * FROM numbers(3) WHERE number=1); +--------+ | number | +--------+ | 0 | | 1 | | 2 | | 3 | | 4 | +--------+

Was this page helpful?