codegurukool.com · Free coding tutorials & online compiler

Home › SQL Tutorial › SQL INNER JOIN

SQL INNER JOIN

Combine rows from two tables.

A join links tables through matching columns. INNER JOIN keeps only rows that match on both sides. Here Orders.customer_id points to Customers.id (a foreign key).

Example code

SELECT c.name, o.amount
FROM Customers c
INNER JOIN Orders o ON c.id = o.customer_id
ORDER BY o.id;

Run this code in the online editor

← SQL aliasesSQL LEFT, RIGHT, FULL and SELF JOIN →