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

前端 未结 9 2323
梦谈多话
梦谈多话 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:38

    For example, your database has tables which store information about Sales and Human resource departments, you could name all your tables related to Sales department as shown below:

    SL_NewLeads SL_Territories SL_TerritoriesManagers

    You could name all your tables related to Human resources department as shown below:

    HR_Candidates HR_PremierInstitutes HR_InterviewSchedules

    This kind of naming convention makes sure, all the related tables are grouped together when you list all your tables in alphabetical order. However, if your database deals with only one logical group of tables, you need not use this naming convention.

    Note that, sometimes you end up vertically partitioning tables into two or more tables, though these partitions effectively represent the same entity. In this case, append a word that best identifies the partition, to the entity name

提交回复
热议问题