This statement is used to return the union set of multiple query results.
1 | select_statement UNION [ALL] select_statement; |
UNION: The set operation is used to join the head and tail of a table based on certain conditions. The number of columns returned by each SELECT statement must be the same. The column type and column name may not be the same.
To return the union set of the query results of the SELECT * FROM student _1 and SELECT * FROM student _2 commands with the repeated records removed, run the following statement:
1 | SELECT * FROM student_1 UNION SELECT * FROM student_2; |