natural-join

Is NATURAL (JOIN) considered harmful in production environment?

半城伤御伤魂 提交于 2019-11-26 18:32:49
问题 I am reading about NATURAL shorthand form for SQL joins and I see some traps: it just takes automatically all same named column-pairs (use USING to specify explicit column list) if some new column is added, then join output can be "unexpectedly" changed too, which may be not so obvious (even if you know how NATURAL works) in complicated structures 回答1: NATURAL JOIN syntax is anti-pattern: The purpose of the query is less obvious; the columns used by the application is not clear the columns

Difference between natural join and inner join

我们两清 提交于 2019-11-26 04:59:12
问题 What is the difference between a natural join and an inner join? 回答1: One significant difference between INNER JOIN and NATURAL JOIN is the number of columns returned. Consider: TableA TableB +------------+----------+ +--------------------+ |Column1 | Column2 | |Column1 | Column3 | +-----------------------+ +--------------------+ | 1 | 2 | | 1 | 3 | +------------+----------+ +---------+----------+ The INNER JOIN of TableA and TableB on Column1 will return SELECT * FROM TableA AS a INNER JOIN