Is NATURAL (JOIN) considered harmful in production environment?

后端 未结 6 1003
野性不改
野性不改 2020-12-03 21:39

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 USI
6条回答
  •  无人及你
    2020-12-03 22:36

    I agree with the other posters that an explicit join should be used for reasons of clarity and also to easily allow a switch to an "OUTER" join should your requirements change.

    However most of your "traps" have nothing to do with joins but rather the evils of using "SELECT *" instead of explicitly naming the columns you require "SELECT a.col1, a.col2, b.col1, b.col2". These traps occurs whenever a wildcard column list is used.

提交回复
热议问题