01Chapter 1: Combining result sets: the idea behind set operatorsThis chapter assumes you can write basic SELECT queries with WHERE, that you understand tables, rows, and columns, and that you know how DISTINCT and NULL behave. The examples use UNION and UNION ALL, which run on PostgreSQL, MySQL, SQLite, and SQL Server.1 min read
02Chapter 2: INTERSECT: rows present in both resultsThis chapter assumes you can write SELECT with WHERE, you know what DISTINCT does, and you understand that NULL marks a missing value. The examples use two tables, customers and newsletter_subscribers, and an unsubscribed table. Each has an email column.1 min read
03Chapter 3: Sorting and limiting combined resultsThis chapter assumes you can write SELECT with WHERE, use DISTINCT and ORDER BY, and combine two queries with UNION, INTERSECT, or EXCEPT. Examples use PostgreSQL or MySQL syntax unless noted.1 min read