Bird
0
0

Which condition must be true for two SELECT statements to be combined using UNION in SQL?

easy📝 Conceptual Q1 of 15
SQL - Set Operations
Which condition must be true for two SELECT statements to be combined using UNION in SQL?
ABoth SELECT statements must have identical column names.
BBoth SELECT statements must have the same number of columns with compatible data types.
CBoth SELECT statements must use the same WHERE clause.
DBoth SELECT statements must select from the same table.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the requirement for UNION

    UNION combines results vertically, so columns must match in number and type.
  2. Step 2: Check each option against the rule

    Only Both SELECT statements must have the same number of columns with compatible data types. states the correct rule about column count and compatible types.
  3. Final Answer:

    Both SELECT statements must have the same number of columns with compatible data types. -> Option B
  4. Quick Check:

    Set operation column matching = D [OK]
Quick Trick: UNION needs same column count and compatible types [OK]
Common Mistakes:
MISTAKES
  • Assuming tables must be the same
  • Believing WHERE clauses must match
  • Thinking column names must be identical

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes