Q:
What is UNION , UNION ALL?
Answer
Both these are used to combine the results of different SELECT statements.
UNION - Selects only distinct values
UNION ALL - Selects duplicate values also
Syntax:
SELECT column_name(s) FROM table1
UNION / UNION ALL
SELECT column_name(s) FROM table2;
Notice that each SELECT statement within the UNION must have the same number of columns. The columns must also have similar data types. Also, the columns in each SELECT statement must be in the same order.
View answer
Workspace
Report Error
Discuss