The main difference between join and inner join is that join is a generic term for combining data from two or more tables, while inner join is a specific type of join that only returns rows where there is a match in both tables.
Here is a table that summarizes the differences between join and inner join:
Feature
Join
Inner join
Returns all rows from both tables
Yes
No
Returns only rows where there is a match in both tables
No
Yes
Used when you want to combine data from two or more tables
Yes
Yes
Used when you want to return only rows where there is a match in both tables
No
Yes
For example, the following code will join the Customers and
Orders tables:
SQL
SELECT *
FROM Customers
JOIN Orders
ON Customers.CustomerID = Orders.CustomerID;
This code will return all rows from the Customers table, even if there are no matching rows in the
Orders table.
The following code will inner join the Customers and Orders tables:
SQL
SELECT *
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID;
This code will only return rows from the Customers table where there is a matching row in the
Orders table.
The INNER JOIN keyword is the most common type of join, and it is the default join type in most SQL databases.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
The main difference between join and inner join is that join is a generic term for combining data from two or more tables, while inner join is a specific type of join that only returns rows where there is a match in both tables.
Here is a table that summarizes the differences between join and inner join:
For example, the following code will join the
CustomersandOrderstables:SQL
This code will return all rows from the
Customerstable, even if there are no matching rows in theOrderstable.The following code will inner join the
CustomersandOrderstables:SQL
This code will only return rows from the
Customerstable where there is a matching row in theOrderstable.The
INNER JOINkeyword is the most common type of join, and it is the default join type in most SQL databases.