Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 M-N relationship design

Author  Topic 

GoDaddy
Yak Posting Veteran

64 Posts

Posted - 2009-11-05 : 09:14:37
Let's say I have these Tables :
Carriers (UPS, FedEx, etc)
CarrierServiceType (Ground, Air, etc)
CarrierServices (carrierId, carrierServiceTypeId) [M-N] relationship
Orders (carrierId, carrierServiceTypeId)

On CarrierServices the PK is both FK.

Now on the Orders, I made a FK using both carrierId and carrierServiceTypeId to point to CarrierServices.

My question is, do I still have to do a seperate FK from carrierId to Carriers and carrierServiceTypeId to carrierServiceTypes?

IMO, I shouldn't need it since the integrity is already enforce from the CarrierServices table.

I just want to make sure I'm doind the right thing.

Thanks,

nathans
Aged Yak Warrior

938 Posts

Posted - 2009-11-07 : 02:40:01
Right, you dont need the CarrierId in the Orders table at all in this model.
Go to Top of Page
   

- Advertisement -