Skip to content
Theory · Set operations and CTEs · lesson 1 of 10

UNION and UNION ALL

Two lists stapled under a UNION ALL tag keep a repeated name; merged under a UNION tag they keep it once

Until now a query had one main SELECT. Sometimes you need something else: take the results of two queries and put them into one list.

In this lesson

  • UNION ALL keeps everything
  • UNION removes duplicates
  • Rows are compared whole
  • Rules for combining
  • Common mistake
  • Key points