EXISTS (subquery)
Example
SELECT first_name,
last_name
FROM customer c
WHERE EXISTS
(SELECT 1
FROM payment p
WHERE p.customer_id = c.customer_id
AND amount > 11 )
ORDER BY first_name,
last_name;
NOT EXISTS 연산자는 EXISTS 연산자의 반대의 결과를 출력
NOT EXISTS 연산자는 subquery 가 1튜플(row)이라도 반환되는 경우, 결과가 false 로 반환됩니다.
Example
SELECT first_name,
last_name
FROM customer c
WHERE NOT EXISTS
(SELECT 1
FROM payment p
WHERE p.customer_id = c.customer_id
AND amount > 11 )
ORDER BY first_name,
last_name;
VALUE IN (value1, value2, ...)
VALUE IN ( SELECT value FROM table_nm )
Example
SELECT
customer_id,
rental_id,
return_date
FROM
rental
WHERE
customer_id NOT IN (1, 2);
<> (not equal operator)
SELECT
customer_id,
rental_id,
return_date
FROM
rental
WHERE
customer_id <> 1
AND customer_id <> 2;