SQL 中命名中间表的标准做法是什么?
我有一个名为“产品”的表和一个名为“商店”的表。每个商店都有其销售的产品列表。我需要一个包含 ShopID 和 ProductID 的中间表。我应该怎么称呼那张桌子?我的脑子一片空白。
选购产品?
编辑:也许我应该称之为“ShopAvailableProducts”?或者说这太混乱了。
I have a table called Product and a table called Shop. Each shop has a list of Products that it sells. I need an intermediate table that has ShopID and ProductID in it. What should I call that table? My mind has drawn a blank.
ShopProducts?
Edit: Perhaps I should call it "ShopAvailableProducts"? Or is that too confusing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
是的 ShopProduct (取决于您使用的复数)将是我命名链接实体的方式。
所以一个商店可以有很多产品,每种产品可以在很多商店出售
Yes ShopProduct (depending on the plurals you use) would be how I'd name a link entity.
So a shop can have many products and each product can be sold in many shops
我更喜欢类似于
ShopProductsJunction
的东西。 本文可能会提供一些其他命名提示:I prefer something along the lines of
ShopProductsJunction
. This article might give a few other naming hints:是的,ShopProducts 就足够好了。没问题
Yes, ShopProducts is good enough. No problem with that
就我个人而言,我只会使用 ShopProduct,因为它在我的语言中是有意义的,是用于/来自/与商店相关的产品。
Personally I would just use ShopProduct as it makes sense in my language a product for/from/asociated-with a shop.
我见过 ORM 使用
product_shop_rel
。例如 OERP(现在称为 Odoo)。I have seen
product_shop_rel
used by ORMs. Like in OERP (now known as Odoo) for example.Shop2Product(或 Product2Shop)更好:中间的“2”表明这是中间表。
Shop2Product (or Product2Shop) is better: "2" in mid shows that this is intermediary table.