Self-joins and set operations: two ways to compare rows

Use aliases to compare roles in one table, then choose a set operation for compatible projected results. Querying · Databases.

Two reports use the same rows but ask different questions: who belongs to whom, and which projected values overlap? Trace the comparison before choosing the operator.

What you will learn

  • Trace one table through two aliased roles
  • Compare projected rows with four set operations
  • Diagnose duplicate and NULL behavior

Lesson outline

  1. One table, two roles
  2. From projections to sets
  3. Direction and duplicates
  4. A fresh self-join

18 minutes · 6 scenes · 0 predict checks · 15 quiz questions

The full lesson is available with Premium.