we have two tables Stu and marks as shown below:
Stu table:
marks table:
Now, follow the the points to understand difference between Natural Join and Inner Join:
CHARACTERISTICS | NATURAL JOINÂ | INNER JOIN |
Syntax | Select Column from Table_Name Table1 Natural Join Table2; | Select Column from Table_Name Table1 Inner Join Table2 on Table1.Column=Table2.Column; |
Common Columns | In Natural Join, there is no need to mention the common columns. The tables are joined considering the column on basis of name and datatype. | In Inner join, there is a need to explicitly mention the common columns specified on ON Clause. |
Duplicates | In Natural join, when we execute a query, there is never a duplicate entry given to common columns. | In Inner join, we always have a duplicate entry given to a common column. |
Example | select * from Stu natural Join marks; | select * from Stu s inner join marks m on s.Roll_no=m.Roll_no; |
Output of NATURAL JOIN
Output of INNER JOIN
- Log in to post comments