In this tutorial you will learn about the MySQL UNION Keyword and its application with practical example.
MySQL UNION Keyword allows you to combine two or more result sets from multiple tables or queries together.
Table Of Contents−
- The number of columns in each SELECT statement has to be the same .
- The data type of the column in the column list of the SELECT statement must be the same or at least convertible.
MySQL UNION removes all duplicate rows from the result set
Syntax:
1 2 3 4 |
SELECT statement UNION [DISTINCT | ALL] SELECT statement UNION [DISTINCT | ALL] |