Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

EXISTS Conditional Expression

Description

The EXISTS conditional expression returns TRUE if one or more results of the execution of the subquery specified on the right exist, and returns FALSE if the result of the operation is an empty set.

Syntax

EXISTS expression

  • expression : Specifies a subquery and compares to determine whether the result of the subquery execution exists. If the subquery does not produce any result, the result of the conditional expression is FALSE.
Example

--selecting rows using EXISTS and subquery

SELECT 'raise' FROM db_root WHERE EXISTS(

SELECT * FROM condition_tbl WHERE salary < 2500000);

  'raise'

======================

  'raise'

 

--selecting rows using NOT EXISTS and subquery

SELECT 'raise' FROM db_root WHERE NOT EXISTS(

SELECT * FROM condition_tbl WHERE salary < 2500000);

There are no results.