INTERSECT and MINUS

INTERSECT

Returns rows common to both queries.

SELECT department_id FROM employees
INTERSECT
SELECT department_id FROM departments;

MINUS

Returns rows from the first query that are not in the second.

SELECT department_id FROM employees
MINUS
SELECT department_id FROM departments;

These operations are useful for comparing datasets or identifying unmatched records.