Reputation: 8921
I have the following three tables:
And then I have the following sample data on the third table:
Item | Code
-----+-----
001 | A
002 | A
003 | B
There's a possibility that a new Item is added but does not have a code yet. I will assign a default code for this Item, say "Z".
My question is, which is better:
OR
Additional consideration: the default code will always be returned, regardless whether an Item have been assigned a Code or not. So the result from the above data would be:
Code A: Item 001, Item 002
Code B: Item 003
Code Z: Item 001, Item 002, Item 003
Upvotes: 0
Views: 71
Reputation: 432667
Either: don't put a row in ItemCode yet until you know the code (read from file)
Or: make the Code column nullable in ItemCode so it's Unknown/Undefined (depending on your pedantry) and left join/isnull.
I personally don't like storing "default" or "placeholder" values. If you don't know the code, then put nothing. What if you have 2 new items for example?
The other question is: can you deal with this in the client?
Upvotes: 1