Home Oracle Commands

UNION Statement

Combine data from one or more SELECT statements.

In Oracle 8i (and above) the UNION command has been largely replaced 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 command

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




Back to the Top

Simon Sheppard
SS64.com