⭕
Intermediate About 15 min

Set Operations

Combine or compare result sets with UNION, INTERSECT, and EXCEPT — the SQL Venn diagram.

What you'll learn

  • Stack result sets vertically with UNION and UNION ALL
  • Find rows common to both sets with INTERSECT
  • Subtract one result set from another with EXCEPT
  • Understand when UNION ALL is preferred over UNION for performance