mysql UNION operator
Translation results:
UK[ˈju:niən] US[ˈjunjən]
n. Alliance, alliance; association, trade union; union, unity
adj. The plural of trade union: unions
mysql UNION operatorsyntax
Function: Used to merge the result sets of two or more SELECT statements.
Syntax: SELECT column_name(s) FROM table_name1 UNION SELECT column_name(s) FROM table_name2
Description: Please note that the SELECT inside UNION Statements must have the same number of columns. Columns must also have similar data types. Also, the order of the columns in each SELECT statement must be the same.
Note: By default, the UNION operator selects different values. If duplicate values are allowed, use UNION ALL. In addition, the column names in the UNION result set are always equal to the column names in the first SELECT statement in the UNION.
mysql UNION operatorexample
//列出所有在中国和美国的不同的雇员名 SELECT E_Name FROM Employees_China UNION SELECT E_Name FROM Employees_USA;