such as a material table- Article
the table associated with it is the material category table- Article_Type
there is also a material library grouping table- Article_Group
associated tables are generally separated by _
underscores. If there are many associated tables, such as Article_Group_Type_Module
, I will name them Article_Module
. It looks concise and comfortable by omitting the middle table directly.
has already had a similar problem:
Mysql intermediate relational table
users / / user table
plugins / / plug-in
user_plugin_relationships / / user plug-in relationship table
you name it a1_cat_relationships directly, and then write what the table is used in the primary key into the remarks.
the database is for developers to see. If you unify a set of internal rules, you will OK
.
such as goods, or goods_category, you can goods_goods_category, directly. You just need to name it and see what it means. Add a standard name to it, and you can also synthesize revolve_goods_category
.
programmers' variable naming is already a matter of knowledge, and I can't understand what it means from the beginning of the A1
table.
English is good to use words directly, bad to go to Youdao, variable as long as possible, to express the meaning clearly, but the table name should not be too long, you can use more abbreviations.
but this A1
is too simple.
to share a repo: carlos-wong/cerebro-codelf
introduction is: save 3s for your life by naming variables (Save 3 seconds of your life when naming things.)
).
needs to establish an associated table, so generally speaking, A1 and a1_cat are many-to-many relationships. According to your naming, a1_cat and A1 have an one-to-one or one-to-many relationship to ensure good naming habits.
for example, tables an and b need to establish an associated table, which can be followed by a _ map (any word that represents the relationship, such as the relevance), you mentioned, such as a_b_map. If there are too many underscores, you can selectively remove some characters. For example, the associated table of A1 and a1_cat is a1_cat_map instead of a1_a1_cat_map.