By 25/02/2016 1 Comments

What Is UNION Operator In SQL?

  • The SQL UNION operator combines multiple SELECT statements results.
  • When you use UNION operator in SELECT statements each SELECT statement must have the same number of columns, similar data types and same order.
  • The SQL UNION operator selects only unique values by default. If you want to selects/retrieves also duplicate values than use the ALL keyword with UNION operator.

Syntax: UNION

SELECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2;

Example: Use of UNION

SELECT country_name
FROM country
UNION
SELECT city_name
FROM city;

Syntax: UNION ALL

SELECT column_name(s) FROM table1
UNION ALL
SELECT column_name(s) FROM table2;

Example: Use of UNION ALL

SELECT country_name
FROM country
UNION ALL
SELECT city_name
FROM city;






Posted in: Sql

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .