Re: NULLs in primary keys
Posted in 1994
In article <35c2ds$2pv@emory.mathcs.emory.edu> den@dsl.com (Den Donovan) writes: > >On Thu, 15 Sep 1994, Andy Kent wrote: > >> My customer has a table of services charges, keyed on the type of service >> and the cost centre. Some services have different charges for each cost >> centre, others are global. At present the global ones have a cost centre >> of NULL. > >An alternative solution would be to use a recognised value in place of >NULL, such as a space (as you've said) or "NONE". This is an ugly >workaround and it was easier for us to alter the index. Hmm.... I'd argue just the opposite. The connotative value of NULL is closer to "don't know" than it is to "none," even though it works out in some applications that the two are functionally equivalent. If a real-world data item is important enough to be a key column in the database, I would try to choose a design that assigns it a value in every situation. If the cost center is global or corporate-wide, I would use a value to denote that. If that situation happens often, you could set your forms to default to that value. Also, I would choose a non-blank value for that global code. This would convey more information on reports, and would avoid the problem of confusing blanks with NULLs in Informix forms. Of course, just my $.02, Walt. -- Walt Hultgren Internet: walt@rmy.emory.edu (IP 128.140.8.1) Emory University UUCP: {...,gatech,rutgers,uunet}!emory!rmy!walt 954 Gatewood Road, NE BITNET: walt@EMORY Atlanta, GA 30329 USA Voice: +1 404 727 0648