InterSystems SQL Reference
Checks a table for the existence of at least one corresponding row.
predicate tests a specified table, typically for existence of at least a row. Since the SELECT
statement following the EXISTS
is being checked for containing something, the clause is often of the form:
EXISTS (SELECT... FROM... WHERE...)
where a typical statement might be:
WHERE Table_B.Number = Table_A.Number)
In this example, the predicate tests for the existence of one or more rows specified by the subquery.
Note that the test must occur on a SELECT
statement (not on a UNION
The NOT EXISTS
clause tests for the non-existence of a row in a table, as shown in the following example:
WHERE NOT EXISTS (SELECT * FROM BonusTable
WHERE NOT (BonusTable.Result = 'Positive'
AND Employees.EmployeeNum = BonusTable.EmployeeNum))
Content Date/Time: 2019-04-10 14:45:57