Thuta Learning
AdvancedData & Databasesbeginner

INNER JOIN

Relax. We'll talk through this in plain words — no textbook voice.

INNER JOIN only shows rows where both tables have a match. Use it when you only want data where a customer exists and that customer also has an order.

sql
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID = Customers.CustomerID;
You should see
+---------+----------------+------------+ | OrderID | CustomerName | OrderDate | +---------+----------------+------------+ | 10308 | Ana Trujillo | 1996-09-18 | | 10309 | Antonio Moreno | 1996-09-19 | +---------+----------------+------------+ What this code does: Joins the Orders table with the Customers table on CustomerID to show each order alongside its customer's name. Common mistake: Get the ON condition wrong and your results won't be accurate. Write the join condition using the column that actually links the two tables.
INNER JOIN | Thuta Learning