HPlogo ALLBASE/SQL Reference Manual: HP 9000 Computer Systems > Chapter 9 Search Conditions

EXISTS Predicate

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

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 );
Feedback to webmaster