My current data model... (Please take a look)

RickDB

Registered User.
Local time
Today, 09:44
Joined
Jun 29, 2006
Messages
101
What's up everyone, I'm new around here and to db design as well...

I'm posting a really rough data model for the first real database I've been putting together.

I'm still in the early stages, and the concepts behind db design are still pretty foreign to me, so there are bound to be many errors I hope to iron out ASAP.

One specific question:

On all of the data models I have referenced, the "OrderDetails" table has no primary key, can someone help me to understand this? Or explain how it is wrong... Thanks


I was hoping some of the experts and advanced users around here could take a look at this and help steer me in the right direction.

Thanks!!!!
 

Attachments

  • relationships_ROUGH-draft.gif
    relationships_ROUGH-draft.gif
    56.5 KB · Views: 168
I see now the answer to my own question. The keys in many samples for "OrderDetails" is a composite key made up of OrderID & ProductID.

Is this the best way to go? Or would it be better to establish an Auto Number Primary Key for this table alone?

Thanks...
 
I would always use an autonumber.
 
1. ALL tables should have primary keys. If the data doesn't present a candidate key, use an autonumber. I would use an autonumber for the OrderDetails table because I have run into situations where I needed the same item to appear twice on the same order and when I used the compound key, I couldn't do that. If you are POSITIVE you won't run into trouble, the compound key is OK.
2. Save yourself a lot of aggrivation and go back and fix ALL the PK/FK names to be consistant. In at least one case, you are joining to the data value rather than the PK of the lookup table. This will be clearer in your mind when you are linking if ALL PKs end in ID and therefore, ALL FKs end in ID.
 

Users who are viewing this thread

Back
Top Bottom