Bird
0
0

Why does UNION require the same number of columns with compatible data types in both SELECT queries?

hard📝 Conceptual Q10 of 15
SQL - Set Operations
Why does UNION require the same number of columns with compatible data types in both SELECT queries?
ABecause UNION automatically renames columns to match
BBecause UNION combines rows vertically, columns must align to merge correctly
CBecause UNION only works on numeric columns
DBecause UNION sorts the results by column names
Step-by-Step Solution
Solution:
  1. Step 1: Understand how UNION combines results

    UNION stacks rows from both queries vertically, so columns must match in number and type.
  2. Step 2: Check other options

    UNION does not sort by column names, is not limited to numeric columns, and does not rename columns automatically.
  3. Final Answer:

    Because UNION combines rows vertically, columns must align to merge correctly -> Option B
  4. Quick Check:

    Column alignment reason for UNION = D [OK]
Quick Trick: UNION stacks rows; columns must match in count and type [OK]
Common Mistakes:
MISTAKES
  • Thinking UNION sorts by column names
  • Believing UNION only works with numbers
  • Assuming UNION renames columns automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes