HPlogo ALLBASE/SQL Reference Manual > Chapter 9 Search Conditions

EXISTS Predicate

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 9 ♥
E0399 Edition 8
E0897 Edition 7

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 );




Comparison Predicate


IN Predicate