Loading, please wait...

Union All Clause

How To Use Union All Clause In SQL

Introduction:
In this article, you will learn, what union all clause is and how to use union all clause in SQL.

The union all clause is used to join the data between two or more tables. This clause also shows the duplicate data, within the selected tables. Union all clause is similar to union operator.

 

Here, we have two tables-

 

Employee Table

 

 

 

Query Table

 

 

 

Now, we collect same records in both the tables, according to our condition.

 

Syntax

The syntax of union all clause is as follows:

select column1, column2... from table1 [where condition] table2 [where condition]

union all

select column1, column2.... from table1 [where condition] table2 [where condition]

 

 

Example

 

Step 1: We write our query for union all clause.

 

 

 

Now, select and execute this query.

 

Step 2: The output of this query is:

 



 

Summary:
Thus, we learned, union all clause is used to join the data in SQL tables.