•Avoid the use of the comma operator and use JOIN  instead: 

SELECT * FROM t1 JOIN t2 JOIN t3 ON (t1.i1 = t3.i3); 

The same precedence interpretation also applies to statements that mix the comma operator with INNER JOIN , CROSS JOIN , LEFT JOIN , and RIGHT JOIN , all of which have higher precedence than the comma operator. 

•A MySQL extension compared to the SQL:2003 standard is that MySQL permits you to qualify the common (coalesced) columns of NATURAL  or USING  joins, whereas the standard disallows that. 

## 13.2.10.3 UNION Clause 

SELECT ... UNION [ALL | DISTINCT] SELECT ... [UNION [ALL | DISTINCT] SELECT ...] 

UNION  combines the result from multiple SELECT  statements into a single result set. Example: 

## Result Set Column Names and Data Types 

mysql> SELECT 1, 2; +---+---+ | 1 | 2 | +---+---+ | 1 | 2 | +---+---+ mysql> SELECT ’a’, ’b’; +---+---+ | a | b | +---+---+ | a | b | +---+---+ mysql> SELECT 1, 2 UNION SELECT ’a’, ’b’; +---+---+ | 1 | 2 | +---+---+ | 1 | 2 | | a | b | +---+---+ 

•Result Set Column Names and Data Types 

•TABLE in Unions 

•UNION DISTINCT and UNION ALL 

•ORDER BY and LIMIT in Unions 

•UNION Restrictions 

•UNION Handing in MySQL 8.0 Compared to MySQL 5.7 

The column names for a UNION  result set are taken from the column names of the first SELECT  statement. 

Selected columns listed in corresponding positions of each SELECT  statement should have the same data type. For example, the first column selected by the first statement should have the same type as the first column selected by the other statements. If the data types of corresponding SELECT  columns do not match, the types and lengths of the columns in the UNION  result take into account the values retrieved by all the SELECT  statements. For example, consider the following, where the column length is not constrained to the length of the value from the first SELECT : 

