0
Difference between SQL Intersect VS EXCEPT.
Difference between SQL Intersect VS EXCEPT.
INTERSECT
EXCEPT
Example:
-- INTERSECT
SELECT Name FROM Students
INTERSECT
SELECT Name FROM Teachers;
-- → common names in both tables
-- EXCEPT
SELECT Name FROM Students
EXCEPT
SELECT Name FROM Teachers;
-- → names in Students but not in Teachers
Key idea:
INTERSECT = common dataEXCEPT = exclude second result from first