Summary

You have been introduced to compound queries. All SQL statements previous to this hour have consisted of a single query. Compound queries allow multiple individual queries to be used together as a single query to achieve the data result set desired as output. The compound query operators discussed included UNION, UNION ALL, INTERSECT, and EXCEPT (MINUS). UNION returns the output of two single queries without displaying duplicate rows of data. UNION ALL simply displays all output of single queries, regardless of existing duplicate rows. INTERSECT is used to return identical rows between two queries. EXCEPT (the same as MINUS) is used to return the results of one query that do not exist in another query. Compound queries provide greater ...

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