The UNION operator is used to combine the result set of two or more SELECT statements.
Syntax:
SELECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2;
Examples:
select cityname,lookup from city
union
select statename,lookup from state
SQL UNION ALL Example,MySQL UNION ALL Example
UNION ALL to select all column included duplicate values.
Syntax:
SELECT column_name(s) FROM table1
UNION All
SELECT column_name(s) FROM table2;
Examples:
select cityname,lookup from city
union ALl
select statename,lookup from state
0 Comments