Let’s continue exploring table transformation through the union clause. Unions allow us to utilize information from multiple tables in our queries. In this lesson, we’ll utilize data from an …
Sometimes, in order to answer certain questions based on data, we need to merge two tables together and then query the merged result. Perhaps we have two tables that contain information about produ…
Great job! What if we wanted to allow duplicate values? We can do this by using the ALL keyword with UNION, with the following syntax: SELECT column_name(s) FROM table1 UNION ALL SELECT column_nam…
INTERSECT is used to combine two SELECT statements, but returns rows only from the first SELECT statement that are identical to a row in the second SELECT statement. This means that it returns only…
EXCEPT is constructed in the same way, but returns distinct rows from the first SELECT statement that aren’t output by the second SELECT statement. SELECT column_name(s) FROM table1 EXCEPT SELEC…
Congratulations! We just learned about Set Operations in SQL. What can we generalize so far? * The UNION clause allows us to utilize information from multiple tables in our queries. * The UNION AL…