INTERSECT and MINUS

Published July 26, 2025 By Sai Sree Ram Gundepudi

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.

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article