UNION only corresponding columns need to be same data type and when using SQL UNION, only distinct values are selected (is similar to SELECT DISTINCT SQL Statement).
Syntax - UNION
(SQL Statement 1)
UNION
(SQL Statement 2)
Below is example for SQL UNION
Company | Sales($) | Website |
Sql Traniner | 2500 | http://www.sqltutorials.blogspot.com |
BeautyCentury | 3000 | http://beautycentury.blogspot.com |
TravelYourself | 2800 | http://travelyourself.blogspot.com |
Sales | Website |
2900 | http://www.sqltutorials.blogspot.com |
3000 | http://beautycentury.blogspot.com |
2800 | http://travelyourself.blogspot.com |
SQL UNION Statement
SELECT Sales FROM TABLE1
UNION
SELECT Sales FROM TABLE2
Result
Sales |
2500 |
2800 |
2900 |
3000 |