Reputation: 6784
Consider two tables transaction and category each having their own ID and information.
A transaction can have more than one category, I have read creating a 3rd table to link transaction and category using their IDs is best. But what would you call this table, assuming you would have many like it?
transactionCategories is the best I'm coming up with, is there anything better?
Upvotes: 2
Views: 1920
Reputation: 24311
My naming scheme for these is to use the terminology of the domain for the interaction if there is one (eg. not student_class
, but enrollment
). When there is no such terminology, then you fall back onto transaction_category
or category_transaction
whichever sounds better.
Also, I always name my tables in the singular (e.g. student and not students).
Upvotes: 6
Reputation: 9416
I usually use the same approach, the plural helps distinguish it as a relation table, and it contains both names so it's clear which tables.
Upvotes: 1
Reputation: 23141
TransactionCategories is just fine. There probably isn't anything "better", just different.
At times in the past, when I have created a table that just has the two foreign keys it needs to resolve the many-to-many, I append "Xref" to its name, which gives a clue that it doesn't have any attributes. It's just there to resolve the many-to-many.
Upvotes: 1