Skip to main contentSkip to solution

Which of the following is TRUE for union operation in SQL?

Solution

✅ Correct Option: 2

UNION combines the result sets of two SELECT statements and removes duplicate rows. A row present in both tables therefore appears only once in the output. (UNION ALL is the version that keeps duplicates.)

For UNION to work, both queries must return the same number of columns with compatible data types. The number of rows in the tables does not matter.


Option 1: the number of attributes (columns) must be the same, not different.

Option 3: only the column count and types must match; the number of rows can differ.

Option 4: getting common tuples is the job of INTERSECT, not UNION.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question