UNION Statement

Combine data from one or more SELECT statements.

In Oracle 8i and above the UNION command has been supplemented by the new Analytic Features

Syntax:

SELECT command  {UNION | UNION ALL | INTERSECT | MINUS} SELECT command

key:

UNION - Combine the unique rows returned by 2 SELECT statements

UNION ALL - Combine the rows returned by 2 SELECT statements (including all duplicates)

INTERSECT - Return only those rows that are in *both* SELECT statements

MINUS - Return the rows that are in the first SELECT but not the second

To combine more than two SELECTs simply nest the expressions

SELECT expr1 UNION (SELECT expr2 UNION SELECT expr3)

Related Commands:

SELECT - Retrieve data from one or more tables, views, or snapshots.

Related Views:

  DBA_ALL_TABLES       ALL_ALL_TABLES       USER_ALL_TABLES
  DBA_TABLES           ALL_TABLES           USER_TABLES         TAB
  DBA_VIEWS            ALL_VIEWS            USER_VIEWS 
                                                                DICTIONARY
                                                                DICT_COLUMNS


© Copyright SS64.com 1999-2014
Some rights reserved