Natural Join

In this lesson we are going to study about Natural Join in a database.

Natural Join:

  • This join is having a special features ,with the use of this join no need to specify the join condition explicitly.
  • This type of join offer a further specification of equi join .
  • We have to specify the keyword Natural join in the join statement.
  • Natural Join automatically joins two table based on columns in the two table which have same datatype and names.
Example: EMPLOYEE table and DEPARTMENTtable have a same column DepeartmentID and same datatype.
so we can join this two table using
NATURAL JOIN.



SQL :

SELECT *
FROM employee
NATURAL JOIN department;

Note:

  • If we write a where clause of a select statement with two or more table then the order parser will start the join operation from right to left.In this case the table name which is written last will be processed,
  •  The  join can happen only on columns having the same names and same data types in both the table .If the columns have the same name ,but different data types,then the NATURAL JOIN syntex causes an error.


Related Article
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebooktwitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

No comments:

Post a Comment