Chapter 10

SQL Part 4: Subqueries, CTEs, UNION, INTERSECT, EXCEPT

Learning Objectives

  1. Understand what a subqueries are and how they are structured.
  2. Understand the difference between a correlated and non-correlated subqueries.
  3. Understand what a Common Table Expression is and the potential benefit compared to subqueries.
  4. Understand the differences between UNION, INTERSECT, and EXCEPT.

Key Terminology

Subqueries

  1. Subqueries
  2. Correlated subquery

Common Table Expression

  1. Common Table Expression (CTE)

UNION, INTERSECT, EXCEPT

  1. UNION
  2. INTERSECT
  3. EXCEPT