Identify the operation:
It is performed on relations, used to combine the selected rows of two tables at a time. If some rows are the same in both the tables, then the result will show those rows only once.
Identify the operation:
It is performed on relations, used to combine the selected rows of two tables at a time. If some rows are the same in both the tables, then the result will show those rows only once.
Solution
UNION combines the rows of two tables into one result. Rows that appear in both tables are shown only once, because UNION removes duplicates. The two tables must have the same number of columns with compatible data types.
INTERSECT: returns only the rows common to both tables, not all rows from both.
MINUS: returns rows of the first table that are not in the second.
CARTESIAN: pairs every row of one table with every row of the other, so it does not remove duplicates or combine rows in the way described.
UNION ALL keeps duplicate rows, while UNION removes them.
Related questions:
2026: 18 May Shift 2
2025: 20 May Shift 1
2026: 13 May Shift 2
