SQL Server Exists Predicate


The term “predicate” is used to refer to an expression that determines whether something is true or false. Or in other words, it makes an assertion and returns true or false based on that.

The EXISTS predicate accepts a subquery as input and returns true or false, depending on whether the subquery returns a non-empty set or an empty one respectively.

The EXISTS predicate, unlike most predicates in SQL, uses a two-valued logic. It returns either true or false. It cannot return unknown because there is no situation where it doesn’t know whether the subquery returns at last one row or none.

Leave a comment

Your email address will not be published. Required fields are marked *