bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL INNER JOIN

Sql Inner Join

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

Tip:

You can use just

Join

instead of INNER JOIN, as

Inner

is the default join type.

INNER JOIN Syntax

Select

column_name(s)

From

table1

Inner Join

table2 ON table1.column_name = table2.column_name

;

INNER JOIN Example

Look at a product in the

Products table:

ProductID

ProductName

CategoryID

Price

Aniseed Syrup

10.00

And look at a row in the

Categories table:

CategoryID

CategoryName

Description

Condiments

Sweet and savory sauces, relishes, spreads, and seasonings Here we see that the relationship 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:

Previous

SQL Joins

Next

SQL LEFT JOIN