Using INTERSECT operator, Oracle displays the common rows from both the SELECT statements, with no duplicates and data arranged in sorted order (ascending by default).
--1st query SELECT Ename FROM Emp WHERE Deptno = 20; ENAME ---------- JONES SCOTT FORD SMITH ADAMS --2nd query SELECT Ename FROM Emp WHERE Job = 'CLERK'; ENAME ---------- SMITH ADAMS JAMES MILLER
Using INTERSECT to get the common rows from each component queries. That means INTERSECT will give you distinct rows.
SELECT Ename FROM Emp WHERE Deptno = 20 INTERSECT SELECT Ename FROM Emp WHERE Job = 'CLERK'; ENAME ---------- ADAMS SMITH