Back to JOINS, UNION, NULL HANDLING

JOINS - INNER, LEFT AND RIGHT

Understand combining data from multiple tables using INNER/LEFT/RIGHT JOINS

17 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.

Ready to continue?

Mark this lesson as complete when you're ready to proceed.

Key moments

  1. Basic INNER JOIN — The video introduces the concept of joining tables using the common column key.
  2. Ambiguity and Aliasing — The instructor demonstrates how to use table names and aliases to resolve column ambiguity errors.
  3. LEFT and RIGHT Joins — Outer joins are explained, focusing on how LEFT and RIGHT joins retain all rows from one side.
  4. SELF JOIN Implementation — A SELF JOIN is performed by aliasing the same table twice to compare rows internally.
  5. Joining Multiple Tables — The lesson concludes by showing how to chain multiple join operations sequentially in a single query.
PDF notes

Frequently asked questions

Is there a difference between JOIN and INNER JOIN?

No. The keyword JOIN is shorthand; SQL defaults to performing an INNER JOIN if no type (LEFT, RIGHT, FULL) is specified.

Why are aliases necessary if column names are unique?

Aliases are not strictly necessary if column names are unique, but they drastically improve code readability and reduce typing, which is essential for complex queries.

When would I use a SELF JOIN in a real scenario?

SELF JOINs are commonly used to compare employees to their managers (who are also employees) or to find sequential events in a log table.

How do I join three tables?

You chain them: Table A JOIN Table B ON condition 1 JOIN Table C ON condition 2. Each join requires its own ON clause.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.