In this article, we will learn how to use the INNER JOIN keyword in SQL.

The INNER JOIN keyword is used to select records that have matching values in both tables.

The INNER JOIN keyword selects all rows from both tables until there is a match between the columns.

Syntax

SELECT column_name(s)
FROM TABLE_NAME1
INNER JOIN TABLE_NAME2
ON TABLE_NAME1.column_name = TABLE_NAME2.column_name;

Example

The subsequent statement would select all articles with the technology name. If there are records in the Article table that do not have matches in the Technology table, these Articles will not be shown.

SELECT Article.*, Technology.Name
FROM Article
INNER JOIN Technology ON Article.TechID = Technology.ID;

 

Also, check How To Use Alias In SQL