Set Operators in Oracle-Technical Teacher

Set Operators in Oracle-

We can combine multiple queries by using set operators. Set Operator is mainly used to join results of two (or more) SELECT statements.

Here, I will explain you 4 different types. These are-

UNION

UNION ALL

INTERSECT

MINUS

.

1-UNION :Union operator provides combined data from these two select statements and removes duplicates.

 Syntax-

SELECT statement 1


UNION


SELECT statement 2

One question arises in mind…

What are difference between JOIN and UNION?

UNION- it combines data between rows.

JOIN- it combines data between columns.

2-UNION ALL: Union all operator provides combined data from these two select statements and do not remove duplicates.

Syntax-

SELECT statement 1

UNION ALL

SELECT statement 2

3-INTERSECT: Intersect operator provides common data from these two select statements

Syntax-

SELECT statement 1

INTERSECT

SELECT statement 2

4-MINUS: Minus operator provides data present in first SELECT statement and not present in second SELECT statement.

Syntax-

SELECT statement 1

MINUS

SELECT statement 2

 

I hope you will understand different types of set operators in oracle. I meet you in next article.

Thank you!! Keep Reading.

Leave a Reply

Your email address will not be published. Required fields are marked *