What is union? Explain with an example.
UNION - The UNION operator is used to combine the result-set of two or more SELECT statements Tables of both the select statement must have the same number of columns with similar data types. It eliminates duplicates.
Syntax:SELECT column_name(s) FROM table_name1
UNION
SELECT column_name(s) FROM table_name2
Example:SELECT emp_Name FROM Employees_india
UNION
SELECT emp_Name FROM Employees_USA
Explain the union rules.
1. The number and the order of the columns must be the same in all queries.
2. The data types must be compatible.
3. The columns selected in the different SELECT statements must be in the same order.