From the course: Oracle Database 19c: Advanced SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

UNION

UNION - Oracle Database Tutorial

From the course: Oracle Database 19c: Advanced SQL

Start my 1-month free trial

UNION

- [Instructor] Let's jump right into how the Union Set Operator works in Oracle Database and a Select statement along with some examples and how it compares to the other Set Operators. As an overview, the diagram shows the four set operators you can use in Oracle database. Union, Union All, Intersect and Minus. In the Venn diagrams, the yellow area is the result of the set operation. Union combines two results sets and removes duplicates, leaving behind at most the total of the number of rows of both results sets. Union All is similar, but doesn't remove duplicates. The total number of rows is always the sum of the number of rows in both results sets. Intersect takes two results sets and always returns only the rows in common between the two results sets. Finally, Minus returns all the rows from the first result set, but doesn't return whatever rows are in the second result set. We'll focus on the Union set operator. The syntax per set operators is straightforward. Multiple select…

Contents