©  Rahul Batra 2018
Rahul BatraSQL Primerhttps://doi.org/10.1007/978-1-4842-3576-8_13

13. Working in Sets

Rahul Batra1 
(1)
Gurgaon, Haryana, India
 

Set theory is a branch of discrete mathematics that deals with a collection of objects. There is a lot of conceptual overlap between set theory and relational database concepts. It is no wonder that the output of a query is frequently called a resultset.

Primitive set theoretic operations like union, intersection, and difference are increasingly supported in various implementations. We will now explore the theory behind these operations and how to use them in SQL.

Union

The union is an operation that combines elements of two sets. Let’s say we have the following two sets consisting of a bunch of numbers (Listing ...

Get SQL Primer: An Accelerated Introduction to SQL Basics 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.