Skip to content
Exercises · Q16

Q.What does the UNION operator do? State the conditions two SELECT statements must satisfy to be combined with UNION, and explain the difference between UNION and UNION ALL.

ChseodishaTextbookSubjectiveImportance★★★★★est
38% · 6/16 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The UNION operator combines the results of two SELECT queries by placing their rows one below the other — that is, it stacks rows (row-wise), unlike a join, which combines columns (column-wise).

Conditions for UNION: the two SELECT statements must return the same number of columns, and the corresponding columns must have compatible (matching) data types. For example, combining a list of current and former employee names:

SELECT Name FROM Employee
UNION
SELECT Name FROM FormerEmployee;
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.