Is NATURAL (JOIN) considered harmful in production environment?

后端 未结 6 995
野性不改
野性不改 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:23

    One thing that completely destroys NATURAL for me is that most of my tables have an id column, which are obviously semantically all different. You could argue that having a user_id makes more sense than id, but then you end up writing things like user.user_id, a violation of DRY. Also, by the same logic, you would also have columns like user_first_name, user_last_name, user_age... (which also kind of makes sense in view that it would be different from, for example, session_age)... The horror.

    I'll stick to my JOIN ... ON ..., thankyouverymuch. :)

提交回复
热议问题