H
H
HellWalk2018-04-25 16:12:13
MySQL
HellWalk, 2018-04-25 16:12:13

How do you name the link tables?

I think everyone understands the importance of systematization: project, code, names, etc.
Delving into one someone else's project, I thought that it was bad that the many-to-many relationship tables were not named somehow in a special way, so that it was immediately clear that this was a relationship table.
Do you name the link tables somehow in a special way?
For example, there are tables:
accounts
awards
It would be possible to make a table of links between accounts with awards:
link_account_to_awards
But it turns out to be too long. Maybe someone has a better solution? It's just that account_to_awards looks pretty impressive too, but with link_ in front, such tables will all be in one place, in the list of tables (this is especially useful when there are 100+ tables)

Answer the question

In order to leave comments, you need to log in

6 answer(s)
T
Therapyx, 2018-04-25
@Therapyx

I used to do it depending on the association (n:m, *:n, 1:n, etc.)
In your case, as I understand it, a specific account has "n" awards, then - AccountToAwards. If "different" accounts are attached to the table of specific awards, then I would call AwardToAccounts

D
Dmitry Kim, 2018-04-25
@kimono

I usually name fk (foreign key), main table and "linked" one:
fk_account_awards

S
SagePtr, 2018-04-25
@SagePtr

I usually call account_awards

X
xmoonlight, 2018-04-25
@xmoonlight

Without hesitation, I looked at the CMS Joomla!
Here's how they do it: user_usergroup_map(mapping the user into groups and vice versa)

V
Vladimir, 2018-04-25
@de1vin

used to call
it now
accounts_awards_relation

M
Maxim Fedorov, 2018-05-09
@Maksclub


accounts
awards

I call by relationship:
I work in Storm with a database, so I just type the right name in letters and I quickly get what I need without problems with prepositions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question