Beginner

474. JOIN to Find Matched Records

Learn how INNER JOIN can identify records that exist in both tables.

📘 Lesson 474 of 728 ⏱ 10 min 🎯 Intermediate

INNER JOIN returns only rows where the join condition finds a matching record in both tables.

Matching records is one of the most common requirements when combining related business data.

Find customers who have placed at least one order.

SQL
SELECT DISTINCT
    c.CustomerID,
    c.CustomerName
FROM Customers c
INNER JOIN Orders o
    ON c.CustomerID = o.CustomerID;

Used in customer activity, transaction analysis, employee reporting, and system reconciliation.

  • INNER JOIN returns matching records.
  • Rows without a match are excluded.
  • DISTINCT can remove repeated customer combinations.
  • Join keys determine what counts as a match.
  • INNER JOIN is commonly used for relationship analysis.
What records does INNER JOIN return?

It returns records where the join condition matches rows from both tables.

How can INNER JOIN find active customers?

Join Customers with Orders using CustomerID and return the matching customers.

Have you finished this lesson?

Introduction to SQL – All Lessons