Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle UNION ALL Operator

The Oracle UNION ALL operator is allow you to combine the result-set of two or more SELECT statements together. It combines the both SELECT statement and does not remove duplicate rows between the various SELECT statements.

Oracle UNION ALL OPERATOR Syntax

To combines the both SELECT statement and does not remove duplicate rows between the various SELECT statements, use the following syntax:

Syntax

SELECT col1,col2... FROM tablename1
UNION ALL
SELECT col1,col2... FROM tablename2;

Parameters:

tablename: The table name from which you want to perform UNION operator.

UNION ALL: To combine the result-set of two or more SELECT statements.

Oracle UNION ALL OPERATOR example

The following Oracle, returns all the "firstName", "lastName" and "address" including duplicate rows from "tblCustomer" and "tblCustomerLoan" table:

Example

SELECT firstName, lastName, address FROM tblCustomer 
UNION ALL
SELECT firstName, lastName, address FROM tblCustomerLoan;

Note:

In the above example, the UNION ALL operator will return all records from "tblCustomer" and "tblCustomerLoan" table including duplicate rows.