Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
community creator

What's the difference between JOIN and INNER JOIN?

Behzad Ahmad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The JOIN syntax retrieves the same columns from two or more database tables or databases. Meanwhile, the INNER JOIN is functionally the same as the JOIN; both produce the same results.

Comparison

The comparison operator is used to match rows from two tables based on shared values from each table.

The JOIN statement creates ambiguity about which kind of JOIN the developer refers to because there are multiple JOIN statements such as: Outer Join, Left Outer Join, Right Outer Join. Therefore, INNER JOIN is an excellent approach to avoid such ambiguity.

The syntax of the JOIN statements varies, so we need to specify the right one. As JOIN and INNER JOIN have the same function, we might neglect the word INNER while coding.

The JOIN statement

Let’s view the syntax of the JOIN statement.

SELECT *
FROM
TableNo1 JOIN TableNo2
ON TableNo1.columnName = TableNo2.columnName;
JOIN

The INNER JOIN statement

Let’s view the syntax of the INNER JOIN statement.

SELECT *
FROM
TableNo1 INNER JOIN TableNo2
ON TableNo1.columnName = TableNo2.columnName;
INNER JOIN

Note: Both of these queries produce the same results.

RELATED TAGS

sql
community creator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring