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 live online training, plus books, videos, and digital content from nearly 200 publishers.