Chapter 13. Combining Table Expressions

Introduction

In Section 6.4, in Chapter 6, “SELECT Statements, Table Expressions, and Subqueries,” we introduce the term compound table expression. With the help of set operators, the results of individual table expressions can be combined. In that section and several other chapters, examples are given of the set operator called UNION. With this operator, results of table expressions are placed underneath each other. SQL supports other set operators besides the UNION operator. Here is the complete list:

  • UNION

  • UNION ALL

  • INTERSECT

  • INTERSECT ALL

  • EXCEPT

  • EXCEPT ALL

Chapter 6 defines the table expression and the compound table expression. However, only the UNION operator is mentioned there. Now, we extend that definition ...

Get Introduction to SQL: Mastering the Relational Database Language, Fourth Edition/20th Anniversary 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.