MySQL naming conventions, should field name include the table name?

前端 未结 9 2315
梦谈多话
梦谈多话 2021-02-07 08:59

A friend told me that I should include the table name in the field name of the same table, and I\'m wondering why? And should it be like this? Example:

(Table)         


        
9条回答
  •  暖寄归人
    2021-02-07 09:33

    With generic fields like 'id' and 'name', it's good to put the table name in.

    The reason is it can be confusing when writing joins across multiple tables.

    It's personal preference, really, but that is the reasoning behind it (and I always do it this way).

    Whatever method you choose, make sure it is consistent within the project.

提交回复
热议问题