Table of Contents

Search

  1. About the Data Vault SQL Reference
  2. Introduction to SQL Reference for Informatica Data Vault
  3. Date and Time Arithmetic
  4. WHERE Clauses
  5. UNION Operator
  6. Parameterized Query
  7. Functions

Data Vault SQL Reference

Data Vault SQL Reference

UNION ALL

UNION ALL

The UNION ALL query combines the result sets of multiple SELECT statements. It returns all rows from the queries, including rows returned from more than one SELECT statement. It does not remove duplicate rows from the final result set.

Syntax

The UNION ALL operator has the following syntax:
SELECT column1 [, columnN ] FROM table1 [, tableN ] [WHERE clause] UNION ALL SELECT column1 [, columnN ] FROM table1 [, tableN ] [WHERE clause]
Examples
The following UNION ALL query returns all product IDs from the first and second SELECT statements:
SELECT product_id FROM order_items UNION ALL SELECT product_id FROM inventories;
The following UNION ALL query uses parentheses to specify the precedence of evaluation :
SELECT * FROM departments UNION ALL (SELECT * FROM warehouses UNION SELECT * FROM offices);
All three tables must have the same number of columns of the same data type.

0 COMMENTS

We’d like to hear from you!