Result Sets Operations
Take a look at some result sets operations in SQL using union and except clauses.
We'll cover the following
SQL also includes set operations for combining queries result sets into a single one.
In our data model, we have driverstandings
and constructorstandings
—they contain data that come from the results
table that we’ve been using a lot so that we can query a smaller dataset or write simple SQL queries.
The set operations are union
, intersect
, and except
.
The union
operator
As expected with the union, we can assemble a result set from the result of several queries.
In writing the query, you might notice that we parenthesized the branches of the union. It’s not required that we do so, but it improves the readability of the query and makes it obvious as to what dataset the order by
clause is applied to.
Get hands-on with 1400+ tech skills courses.