4

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.

NibblyPig
  • 51,118
  • 72
  • 200
  • 356
  • dupe of http://stackoverflow.com/questions/3045034/whats-the-correct-name-for-a-association-table-many-to-many-relationship – Kate Gregory Jun 24 '10 at 10:48
  • possible duplicate of [Is there an official name for the many-to-many relationship table in a database schema?](http://stackoverflow.com/questions/1429908/is-there-an-official-name-for-the-many-to-many-relationship-table-in-a-database-s) – ChrisW Jun 24 '10 at 10:50
  • @ChrisW - May well be a dupe but that linked one is about the name of the concept not of the individual tables. – Martin Smith Jun 24 '10 at 10:54

6 Answers6

8

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

amelvin
  • 8,919
  • 4
  • 38
  • 59
1

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

Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
0

Yes, ShopProducts is good enough. No problem with that

vodkhang
  • 18,639
  • 11
  • 76
  • 110
0

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

Preet Sangha
  • 64,563
  • 18
  • 145
  • 216
0

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

Touten
  • 190
  • 12
-1

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

SQLDev
  • 216
  • 2
  • 4