|
Posted by serge on 10/31/05 07:11
> But for other datatypes it's necessarily not so. In some contexts a 0
> for a numeric value can serve as a NULL, because the actual domain for
> the value is >= 1. Or if the domain is >= 0, you can use -1. Because that
> is really what you need: an out-of-band value to represent the unknown.
> For dates, there are probably a whole lot of dates you can use. But
> there starts the problem. Which value did you use to represent N/A for
> this column?
Good point but like I just replied to Hugo it's not my problem. It's up
to our developers to deal with these scenarios as they are the ones
who chose not to deal with NULLs at all in their code.
> It gets even worse with foreign keys. In an OrderDetails table, there
> is a CampaignID column for the case the customer order the product as the
> result of a campaign. But what if there is no campaign. Do you add a
> "NoCampaign" row to your Campaigns table? A NULL is so much easier to
> handle.
I did see some default values set to -1 so I'll look into more in this as I
am
guessing now we're using -1 to deal with this scenario you just explained.
I'll keep this in mind and as I learn more I'll see how we handle these type
of scenarios and then I'll be able to determine if we can do things
differently
and better.
Thank you
Navigation:
[Reply to this message]
|