Hour 19

Combining Multiple Queries into One

What You’ll Learn in This Hour:

  •    Identifying the operators that combine queries

  •    Knowing when to use the commands to combine queries

  •    Using the GROUP BY clause with the compound operators

  •    Using the ORDER BY clause with the compound operators

  •    Retrieving accurate data

In this hour, you learn how to combine SQL queries using the UNION, UNION ALL, INTERSECT, and EXCEPT operators. Because SQL is meant to work on data in sets, you need to combine and compare various sets of query data. The UNION, INTERSECT, and EXCEPT operators enable you to work with different SELECT statements and then combine and compare the results in different ways. Again, check your particular implementation for ...

Get SQL in 24 Hours, Sams Teach Yourself, 7th 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.