Chapter 15. Union and Union All

The union was introduced in the last chapter because it was needed to code a full outer join. In this chapter, we discuss the union in detail. Union and union all provide two more ways to combine tables.

Forming a union can be a very powerful technique. Unfortunately, many people do not understand it or use it very well. Skillful use of unions can replace many more complex features of SQL, such as outer joins or if-then-else logic.

Get SQL Fundamentals, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.