INNER JOIN
Inner Join joins two table on the basis of the column which is explicitly specified in the ON clause. The resulting table will contain all the attributes from both the tables including common column also.
Syntax
SELECT *
FROM table1 INNER JOIN table2 ON table1.Column_Name = table2.Column_Name;
Query
Consider the above two tables and the query is given below:
SELECT *
FROM Student S INNER JOIN Student_Marks M ON S.Roll_No = M.Roll_No;
Output
Difference between Natural join and Inner Join in SQL
The join operation merges the two tables based on the same attribute name and their datatypes are known as Natural join Unlike INNER JOIN, which requires you to specify the columns and conditions for the join explicitly. In this article, we will also see the differences between them. Let’s start with Natural Join.
Example:
If you have two tables “Student” and “Student_Marks” and you want to retrieve a record of students who have got marks then we use INNER JOIN using a shared column like ”ROLL_No”.