Question #76329

Difference between natural join and inner join

Expert's answer

- A "natural join" is a join where the joining attributes are defined as having equal names, so they need not be stated explicitly.

- A "inner join" is one where the joining attributes do not have to have equal names, so they should to be specified in the "on"

Another difference is the number of returned columns. A "natural join" does not duplicate columns, but "inner join" does duplicate.

Example:

Consider Table A and TableB:

Table A



Table B


INNER JOIN:

SELECT * FROM TableA INNER JOIN TableB ON TableA.Column1 = TableB.Column1


The result of the "inner join" has duplicated columns: TableA.Column1 and TableB.Column1


NATURAL JOIN:

SELECT * FROM TableA NATURAL JOIN TableB


The result of the "natural join" has not duplicated columns


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS