UNION in Teradata

UNION combines the rows from the results obtained from the participating queries.
It eliminates the duplicate rows in the final result set, by default.
UNION performs OR operation.

Sample Syntax:
SELECT columnset
FROM table_name1
UNION ALL
SELECT columset
FROM table_name2
.
.


Note:
The columnset must be equal as per the below cases.
(i.e.) SELECT statements must contain same number of columns
Datatypes of corresponding columns must be same.
Column names can differ.

The component query cannot be sorted using ORDER BY clause.

Example:
SELECT id
FROM tbl_emp
WHERE id>1000
UNION
SELECT id
FROM tbl_dept
WHERE id>200