Set Operations
Lesson 1 of 1
  1. 1
    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 …
  2. 2
    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…
  3. 3
    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…
  4. 4
    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…
  5. 5
    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…
  6. 6
    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…