🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

SQL – INNER JOIN

Retrieve records that have matching values in both tables using INNER JOIN.

INNER JOIN returns only the rows where the join condition is satisfied in both tables. Rows that exist in one table but have no match in the other are completely excluded from the result. Think of it as the intersection of two circles in a Venn diagram — only the overlapping section.

This is the most common type of join and is simply written as JOIN (without the word INNER) in most queries, since inner is the default join behavior.

Venn diagram mental model

  • Circle A = Table 1
  • Circle B = Table 2
  • INNER JOIN = only the overlapping center
  • Rows with no partner in the other table are dropped

Try It Yourself — Interactive SQL Editor

Edit the query below and click Run Query ▶ to see live results powered by SQLite running directly in your browser.

SQLite – edit & run
Results
← Click Run Query ▶ to see results

Key Points

  • INNER JOIN = the default JOIN type — both words are equivalent
  • Only returns rows with matches in both tables
  • Unmatched rows (orphan records) are silently dropped
  • Great for finding records that have related data in another table

Pro Tip from CodesCompiler: The best way to learn SQL is to break things intentionally — modify the query above, change the WHERE conditions, try different columns. Every error teaches you something the docs cannot.

In the next lesson, we continue exploring SQL’s powerful feature set to build your database mastery.