What is Union in SQL?

Union means joining two or more data sets into a single set. In SQL Server, Union is used to combine two queries into a single result set using the select statements. Union extracts all the rows that are described in the query.

Syntax –

query1 UNION query2

Union holds a few conditions before being used in a query. One such condition is that the rows to be extracted must come from the same columns from the tables.