INNER JOIN in SQL for Beginners

Tutorial Playlist

What is INNER JOIN in SQL?

With using Inner Join, we will be able to generate a merged table containing the matching values from the existing participating tables.

Table of Content

Introduction to Inner Join

Records with matching values in the participating tables are returned by a SQL INNER JOIN. As shown below, suppose we have two tables, A and B. Only records that are shared by Tables A and B will be obtained when SQL’s INNER JOIN is used on these two tables.

Syntax Breakdown:

SELECT columns

FROM tableA name

INNER JOIN tableB name

ON tableA.coumn_x = tableB.column_y;

where SELECT, INNER JOIN, and ON are the keywords, columns are the list of columns, tableA is the first table, tableB  is the second table, and column_x and column_y are the columns for performing the INNER JOIN, followed by a semicolon.

SQL INNER JOIN Example

Let’s apply SQL INNER JOIN to two tables, the employee table, and the department table

Select employee.employeeID,employee.e_name,employee.e_DepartmentID, department.departmentID,

department.DepartmentName from employee

INNER JOIN department

ON employee.e_DepartmentID = department.DepartmentID;

After writing the query, click on the execute button to check for errors. Once the query is executed, a message appears like ‘Commands completed successfully.

This brings us to the end of this INNER JOIN in SQL tutorial section. Go ahead and link the tables from your database to get a better insight into your data.

Become a Database Architect

Our SQL Courses Duration and Fees

Program Name
Start Date
Fees
Cohort starts on 14th Jan 2025
₹15,048
Cohort starts on 21st Jan 2025
₹15,048

About the Author

Data Engineer

As a skilled Data Engineer, Sahil excels in SQL, NoSQL databases, Business Intelligence, and database management. He has contributed immensely to projects at companies like Bajaj and Tata. With a strong expertise in data engineering, he has architected numerous solutions for data pipelines, analytics, and software integration, driving insights and innovation.