bg_image
header

Inner Join

An INNER JOIN is a term used in SQL (Structured Query Language) to combine rows from two (or more) tables based on a related column between them.

Example:

You have two tables:

 

Table: Customers

CustomerID Name
1 Anna
2 Bernd
3 Clara

 

Table: Orders

OrderID CustomerID Product
101 1 Book
102 2 Laptop
103 4 Phone

Now you want to know which customers have placed orders. You only want the customers who exist in both tables.

SQL with INNER JOIN:

SELECT Customers.Name, Orders.Product
FROM Customers
INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

Result:

Name Product
Anna Book
Bernd Laptop

Explanation:

  • Clara didn’t place any orders → not included.

  • The order with CustomerID 4 doesn’t match any customer → also excluded.

In short:

An INNER JOIN returns only the rows with matching values in both tables.


Created 1 Day 6 Hours ago
Backend Databases Explicit join Inner Join Relational Database SQL Structured Query Language - SQL

Leave a Comment Cancel Reply
* Required Field