First of all, I understand this question may seem opinion-based, but I know there are some standards for naming conventions and I would like to know which is the best and why. It's not so complex topic it couldn't have maybe 3 - 4 possible solutions and I hope it's okay here.
My basic convention singular/plural of table names is as follows:
- products - plural
- product_variants - mixed - variants of product
This convention worked great, but I got a problem right here:
- I have a products table (yes, I am naming them in plural. Do you think it's bad? Give me arguments why, please)
- I have categories_products table - (I also have categories for ingredients table, that's why it isn't named just categories)
- I didn't want to name it category_products, because it may sound like n:1 products of category
- I have product_categories table, which stores n:n of products AND categories_products
I tried the same with singular:
- product
- category_product - sounds like n:n table
- product_category - sounds like n:n again
Or
- product
- product_category - would be list of categories then
- product2product_category - n:n table
Sound the most clean
But since it's a complex application and I don't want to change all the tables to singular if not necessary, I tried even plural
- products
- product_categories
- products2product_categories
But I don't like that one.
Is there any better way to do such naming, without making observer, or even me, confused?
The very similar question is about enum definition of some dataset, without confusion
- products table have product_status_id - so it's more dynamic than enum
- table product_statuses - sounds like 1:n table - statuses of product
Can somebody turn me into the right direction, and explain why is the direction best?
orders
, where I can't avoid using the word! The key (pardon the pun :-) ) is to pick one style and stick to it!Associative Entity
is a combination of the names of the two tables being joined - another caveat!category_product
- what's the problem you have with what you propose, if your SQL coding style guide/standard allows plural table names?