Re: NULL values or Zero in numeric fields?
Date: 1995/12/12
Message-ID: <4al5h9$91j_at_xmission.xmission.com>#1/1
In article <DIx85u.2y3_at_ulysses.homer.att.com>,
Atul Ashar <aka_at_ulysses.att.com> wrote:
>Say you have a numeric column for age. Age can never be zero so you may not
> define age as nullable. If age is 0 then it is missing.
First of all age is a perfect example of an attribute that should almost never be put in a database because it typically won't be accurate a year later unless the record describes an event of some type.
But more importantly, NULL values mean that either the value is not yet known or does not exist. Any use of a valid value to mean the same thing is defeating the purpose of NULL values and misleading both the SQL engine and other future users.
If you use zero as a null equivalent for age then you are likely to get results like:
Select avg(age) from employee;
AVG_AGE
0.67825
1 row selected.
-- Mark David Butler ( butlerm _at_ xmission.com )Received on Tue Dec 12 1995 - 00:00:00 CET
