SQL 中命名中间表的标准做法是什么?

发布于 2024-09-07 00:59:45 字数 166 浏览 5 评论 0原文

我有一个名为“产品”的表和一个名为“商店”的表。每个商店都有其销售的产品列表。我需要一个包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

拥醉 2024-09-14 00:59:45

是的 ShopProduct (取决于您使用的复数)将是我命名链接实体的方式。

Shop
  |
-----
| | |
ShopProduct
| | |
-----
  |
Product

所以一个商店可以有很多产品,每种产品可以在很多商店出售

Yes ShopProduct (depending on the plurals you use) would be how I'd name a link entity.

Shop
  |
-----
| | |
ShopProduct
| | |
-----
  |
Product

So a shop can have many products and each product can be sold in many shops

我还不会笑 2024-09-14 00:59:45

我更喜欢类似于 ShopProductsJunction 的东西。 本文可能会提供一些其他命名提示:

...也称为交叉引用表、桥接表、连接表、映射表、交集表、链接表或链接表

I prefer something along the lines of ShopProductsJunction. This article might give a few other naming hints:

...also known as a cross-reference table, bridge table, join table, map table, intersection table, linking table, or link table

雾里花 2024-09-14 00:59:45

是的,ShopProducts 就足够好了。没问题

Yes, ShopProducts is good enough. No problem with that

情痴 2024-09-14 00:59:45

就我个人而言,我只会使用 ShopProduct,因为它在我的语言中是有意义的,是用于/来自/与商店相关的产品。

Personally I would just use ShopProduct as it makes sense in my language a product for/from/asociated-with a shop.

原野 2024-09-14 00:59:45

我见过 ORM 使用 product_shop_rel。例如 OERP(现在称为 Odoo)。

I have seen product_shop_rel used by ORMs. Like in OERP (now known as Odoo) for example.

南…巷孤猫 2024-09-14 00:59:45

Shop2Product(或 Product2Shop)更好:中间的“2”表明这是中间表。

Shop2Product (or Product2Shop) is better: "2" in mid shows that this is intermediary table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文