EXISTS 조건식

설명

EXISTS 조건식은 오른쪽에 지정되는 부질의를 실행한 결과가 하나 이상 존재하면 TRUE를 반환하고, 연산 실행 결과가 공집합이면 FALSE를 반환한다.

구문

EXISTS expression

예제

--selecting rows using EXISTS and subquery

SELECT 'raise' FROM db_root WHERE EXISTS(

SELECT * FROM condition_tbl WHERE salary < 2500000);

 

=== <Result of SELECT Command in Line 2> ===

 

  'raise'

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

  'raise'

 

--selecting rows using NOT EXISTS and subquery

SELECT 'raise' FROM db_root WHERE NOT EXISTS(

SELECT * FROM condition_tbl WHERE salary < 2500000);

 

=== <Result of SELECT Command in Line 2> ===

 

There are no results.

 

0 rows selected.