Quantcast
Channel: Active questions tagged referential-integrity - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 60

Do I need a separate Id column for this "mapping" table?

$
0
0

I have a table of Producers and a table of Products, both of which are of the form:

  • Id - int, Primary key
  • Name - nvarchar

A Producer can carry multiple Products, so I was going to create a table called ProducerDetails that would have:

  • ProducerId - int, Foreign key to Producers.Id
  • ProductId - int, Foreign key to Products.Id

Would it be better database design to have an additional Id (int, Primary key) column in my ProducerDetails table?

I'm using SQL Server 2008 R2.

The relationship between these tables is many-to-many. A producer can carry multiple types of products, and the same product could be produced by multiple different producers.


Viewing all articles
Browse latest Browse all 60

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>