Similar to the UNION command, INTERSECT also operates on two SQL statements. The difference is that, while UNION essentially acts as an OR operator (value is selected if it appears in either the first or the second statement), the INTERSECT command acts as an AND operator (value is selected only if it appears in both statements).
INTERSECT operator allows you to combine two table expressions into one and return a result set which consists of rows that appear in the results of both table expressions. INTERSECT operator, like UNION operator, removes all duplicated row from the result sets.
[SQL Statement 1]
[SQL Statement 2]
SQL> SELECT ENANE, EMPNO FROM EMP WHERE
ENAME LIKE'M%' OR ENAME LIKE 'J%';
SELECT ENAME, EMPNO FROM EMP WHERE
ENAME LIKE 'J%' OR ENAME LIKE 'A%';
On execution it will return the common rows that come in first select statement and also in second statement.
Related Articles of SQL