MasterRacker
New member
My formal education in database design is limited so I'm looking for insight to how a pro would approach this. Say I have a table of "items" where I'm storing a qty and a unit of measure for what the quantity represents (ie. lb, oz, quart, etc.). I want the units to come from a list of allowable values so I have them in another table - I've shown the architecture below. My question is: Assuming the codes are going to be unique values, what are the tradeoffs between simply using the code as the foreign key (choice A) and using an ID code (choice B)?
In commercial products I support I've seen this handled both ways. One thing I can think of is if the Items table is large and the unit codes lengthy, storing an ID might save a little space. I certainly don't know the ins and outs of how MS SQL Server does indexing - is there a possibility that one gives better performance than the other?
As a side question, both structures would be considered 3NF would they not?
_____
Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]
In commercial products I support I've seen this handled both ways. One thing I can think of is if the Items table is large and the unit codes lengthy, storing an ID might save a little space. I certainly don't know the ins and outs of how MS SQL Server does indexing - is there a possibility that one gives better performance than the other?
As a side question, both structures would be considered 3NF would they not?
Code:
Items
-----------
ItemID PK
ItemDesc
ItemQty
ItemUnits FK
Units(A) Units(B)
----------- -------------
UnitCode PK UnitID PK
UnitCode
_____
Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]