Question:

Which of the following operations can be performed with the UNION clause in SQL?

Show Hint

Think of what plain UNION does with a repeated row. UNION ALL is the one that keeps duplicates.
Updated On: Oct 1, 2026
  • Fetch only common rows between two tables
  • Combine rows from two tables without duplicates
  • Combine rows from two tables allowing duplicates
  • Combine columns with duplicates
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Understanding the Concept:
UNION is a set operator in SQL. It joins the result of two SELECT queries into one result. The two queries must return the same number of columns with compatible data types.

Step 2: Key Rule:
Plain UNION removes repeated rows from the combined result. UNION ALL keeps every row, including repeated ones.

Step 3: Check option 1.
Fetching only the common rows is the job of INTERSECT, not UNION. UNION returns rows that are in the first result, the second result, or both. So option 1 is wrong.

Step 4: Check option 2.
UNION stacks the rows of the two queries one below the other and then drops duplicate rows. This is exactly the behaviour described. So option 2 is correct.

Step 5: Check option 3.
Allowing duplicates needs the keyword UNION ALL. The question says UNION clause only, and plain UNION does not keep duplicates. So option 3 is wrong.

Step 6: Check option 4.
UNION adds rows, not columns. Putting columns side by side is what a JOIN or a Cartesian product does. So option 4 is wrong.

Final Answer:
UNION combines the rows of two queries and removes duplicates, so the correct choice is option 2. \[ \boxed{2} \]
Was this answer helpful?
0
0