🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to MySQL Notes
Topic #29

MySQL INNER JOIN


MySQL INNER JOIN

The INNER JOIN clause returns only rows that have matching values in both tables.

MySQL INNER JOIN

INNER JOIN Syntax

SELECT table1.column1, table1.column2, ..., table2.column1, ...
FROM table1
INNER JOIN table2
 ON table1.condition_column = table2.condition_column;

Note: The syntax combines two tables based on a related column, and the ON keyword is used to specify the matching condition.


MySQL INNER JOIN Example

Look at a product in the "Products" table:

ProductID ProductName CategoryID Price
3 Aniseed Syrup 2 10.00

And look at a row in the "Categories" table:

CategoryID CategoryName Description
2 Condiments Sweet and savory sauces, relishes, spreads, and seasonings

Here we see that the related column between the two tables above, is the "CategoryID" column.

Now we create an INNER JOIN on the "Products" table and the "Categories" table, via the CategoryID field:

Example

  SELECT
  Products.ProductID, Products.ProductName, Categories.CategoryName
FROM Products
INNER JOIN
  Categories ON Products.CategoryID = Categories.CategoryID;

Note: INNER JOIN returns only rows with a match in both tables. This means that if there is a product with no CategoryID, or with a CategoryID not present in the "Categories" table, that row will not be returned in the result.


JOIN Multiple Tables

You can join more than two tables by adding multiple INNER JOIN clauses in your query.

The following SQL selects all orders with customer and shipper information:

Example

  SELECT Orders.OrderID, Customers.CustomerName, Shippers.ShipperName
FROM
  Orders
INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID
  INNER JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID;

Want to go beyond the notes?

Join CodingNow 2.0's MySQL course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

MySQL INNER JOIN – FAQs

Quick answers about learning MySQL INNER JOIN in MySQL.

This free note from CodingNow 2.0 explains MySQL INNER JOIN in MySQL — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every MySQL topic on CodingNow 2.0, including MySQL INNER JOIN, is 100% free with no signup required.
With focused practice, most students grasp MySQL INNER JOIN in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now