Naming a staging table in a database
Consider two transactions transactions and categories, each with its own identifier and information.
There can be more than one category in a transaction, I read creating a third table to reference the transaction and category using their IDs. But what would you call this table, assuming you have many of these?
transactionCategories is the best I have come up with, is there anything better?
source to share
My naming scheme for these is to use scope terminology for interoperability if there is one (e.g. not student_class
, but enrollment
). When there is no such terminology, then you go back to transaction_category
or category_transaction
whichever is better.
Also, I always name my tables in the singular (for example, student, not students).
source to share
TransactionCategories are just fine. There is probably nothing "better", just different.
Sometimes in the past, when I created a table that has only two foreign keys and needs to solve many-to-many, I add "Xref" to its name, which makes it clear that it doesn't "t have any attributes. It's just for solutions to a many-to-many problem.
source to share