Union

From Oracle FAQ
Jump to: navigation, search

UNION is a SQL set operation that returns all rows from two different select statements, and then eliminates any duplicate rows from the result set.

For example, the below query will return all rows from table_A and table_B (no duplicates):

SELECT * FROM table_A
UNION
SELECT * FROM table_B;

Also see[edit]

  • Intersect - only return rows that are in both tables
  • Minus - return rows that's in table A, but not in table B
  • Union all - combine rows from tables, but don't remove duplicates
Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #