How to do 3-table Natural Join? How to do 3-table Natural Join? sql sql

How to do 3-table Natural Join?


This is indeed the typical syntax for natural joins. However, not all databases support natural joins (for instance, I don't believe SQLServer supports it) and I don't believe there is an ANSI standard for natural join.

Note that natural joins are generally considered dangerous and something to be avoided - this is because they obscure the join relationship that a query depends on, and could result in queries whose meaning changes if the data model is altered.


To check syntax when your SQL product of choice does not support it, use the Mimer SQL-92 validator. You should discover that order and date are reserved words. Change them to my_order and my_date respectively and you will then discover yours is valid Transitional SQL-92 syntax.


using this syntax is considered dangerous as it was already mentioned. Consider the following example:T1(id, name, age)T2(id, age, city)

SELECT T1.id, T1.name, T1.age, T2.ageFROM T1 NATURAL JOIN T2

Which column should be used for join? id or age? It is not defined. Every vendor can implement his own way to solving such problems.

Instead of this syntax, consider using traditional join syntax:

SELECT T1.....FROM T1 INNER JOIN T2 on T1.id=T2.id