INNER JOIN is an SQL operator used to retrieve common data from two or more tables.
It can work with two, three, or more tables, returning only the records that are common across all tables. In this process, the columns act as operands.
Syntax:
SELECT columns FROM table1 INNER JOIN table2 ON table1.common_column = table2.common_column;
Example:
Table1= Employee
employee_id name department_id
1 Mohan 11
2 Anaya 12
3 Babita 13
Table2= Department
department_id department_name
11 HR
12 IT
14 Finance
SQL Query:
SELECT Employees.name, Departments.department_name FROM Employees INNER JOIN Departments ON Employees.department_id = Departments.department_id;
Output:
name department_name Mohan HR Anaya IT
