What is a SEMI-JOIN, and what is the difference between LEFT SEMI JOIN and INNER JOIN?

Quick Overview

Explains what a SQL semi-join is and how a LEFT SEMI JOIN differs from an INNER JOIN in row counts and in the columns it returns. Tests whether you understand join fan-out, existence filters written with EXISTS or IN, and when each join fits a query.

What is a SEMI-JOIN, and what is the difference between LEFT SEMI JOIN and INNER JOIN?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

What is a `SEMI-JOIN`, and what is the difference between `LEFT SEMI JOIN` and `INNER JOIN`? ```hint Count the output rows Picture one left row that matches five rows on the right. How many rows does each join return for it, and which columns can you select? ``` ### What a Strong Answer Covers - A definition of a semi-join as an existence filter on the left table - How the row count differs when a left row has several matches on the right - Which columns each join makes available in the output - How to write a semi-join in databases that have no `SEMI JOIN` keyword ### Follow-up Questions - What is an anti-join, and why can `NOT IN` return no rows when the subquery contains a NULL? - Why is `INNER JOIN` followed by `DISTINCT` not always equivalent to a semi-join? - How does a query engine execute a semi-join, and why can it be cheaper than an inner join?

Overview: Explains what a SQL semi-join is and how a LEFT SEMI JOIN differs from an INNER JOIN in row counts and in the columns it returns. Tests whether you understand join fan-out, existence filters written with EXISTS or IN, and when each join fits a query.

General logo
General
Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

What is a SEMI-JOIN, and what is the difference between LEFT SEMI JOIN and INNER JOIN?

What a Strong Answer Covers Guidance

  • A definition of a semi-join as an existence filter on the left table
  • How the row count differs when a left row has several matches on the right
  • Which columns each join makes available in the output
  • How to write a semi-join in databases that have no SEMI JOIN keyword

Follow-up Questions Guidance

  • What is an anti-join, and why can NOT IN return no rows when the subquery contains a NULL?
  • Why is INNER JOIN followed by DISTINCT not always equivalent to a semi-join?
  • How does a query engine execute a semi-join, and why can it be cheaper than an inner join?