SQL INNER JOIN Clause
Syntax
The INNER JOIN clause in SQL is used to combine rows from two tables where there is a match in the specified columns.
-- Inner join two tables on a common columnSELECT table1.column1, table2.column2FROM table1INNER JOIN table2ON table1.common_column = table2.common_column;Example
-- Retrieve employees and their corresponding department namesSELECT employees.name, departments.department_nameFROM employeesINNER JOIN departmentsON employees.department_id = departments.id;/* Output:| name | department_name ||------------|-----------------|| John Doe | Sales || Jane Smith | Marketing || Alice Brown| HR |*/