Oracle intersection | intersect - oracle tutorial - sql tutorial
![Oracle intersection](https://wikitechy.com/tutorials/oracle/img/oracle-images/oracle-intersection.gif)
Learn oracle - oracle tutorial - Oracle intersection - oracle examples - oracle programs
What is Oracle INTERSECT ?
- The Oracle INTERSECT operator is used to return the results of 2 or more SELECT statements.
- However, it only returns the rows selected by all queries or data sets.
- If a record exists in one query and not in the other, it will be omitted from the INTERSECT results.
![Oracle and Intersect Operator](https://wikitechy.com/tutorials/oracle/img\oracle-images\oracle-and-intersect-operator.gif)
Syntax:
SELECT column_name
FROM Table1
INTERSECT
Select column_name
FROM Table_2;
click below button to copy the code. By - oracle tutorial - team
Example:
SELECT name
FROM wikitechy_employee4
INTERSECT
Select name
FROM wikitechy_employee5;
click below button to copy the code. By - oracle tutorial - team
Screenshot:
- For better understanding we are using the sample table called wikitechy_employee4
![oracle intersect select](https://wikitechy.com/tutorials/oracle/img\oracle-images\intersect-select.png)
- Similarly, we are selecting another table with 3 columns in it.
![intersect select another table](https://wikitechy.com/tutorials/oracle/img\oracle-images\select-another-table.png)
![select and intersect](https://wikitechy.com/tutorials/oracle/img\oracle-images\select-another-table.png)
- Using INTERSECT Statement, we are selecting the common field from the above table,
Oracle Union Vs UnionAll Vs Except Vs Intersect
![Union UnionAll Except Intersect](https://wikitechy.com/tutorials/oracle/img\oracle-images\union-unionall-except-intersect.jpg)