10. UNIONs

“I beseech those whose piety will permit them reverentlyto petition, that they will pray for this union.”

—Sam Houston, Texas hero

Topics Covered in This Chapter

What Is a UNION?

Writing Requests with UNION

Uses for UNION

Sample Statements


Problems for You to Solve

In Chapter 7, “Thinking in Sets,” we introduced three fundamental set operations—intersection, difference, and union. Chapter 8, “INNER JOINs,” showed how to perform the equivalent of an intersection operation by linking result sets on key values using INNER JOIN. Chapter 9, “OUTER JOINs,” discussed how to ask for a set difference by using an OUTER JOIN and testing for the Null value. This chapter explains how to do the third operation, a UNION.

What Is a UNION? ...

Get SQL Queries for Mere Mortals®: A Hands-On Guide to Data Manipulation in SQL, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.