ALLBASE/SQL Reference Manual (36216-90216)

Chapter 9 267
Search Conditions
EXISTS Predicate
EXISTS Predicate
An EXISTS predicate tests for the existence of a row satisfying the search condition of a
subquery. The predicate evaluates to TRUE if at least one row satisfies the search
condition of the subquery.
Scope
SQL Data Manipulation Statements
SQL Syntax
EXISTS
SubQuery
Parameters
SubQuery
A subquery is a nested query. The syntax of subqueries is presented in the
description of the SELECT statement in Chapter 12 , “SQL Statements S -
Z.
Description
Unlike other places in which subqueries occur, the EXISTS predicate allows the subquery
to specify more than one column in its select list.
Example
Get supplier names for suppliers who provide at least one part.
SELECT S.SNAME
FROM S
WHERE EXISTS ( SELECT * FROM SP
WHERE SP.SNO = S.SNO );