Re: NULL values or Zero in numeric fields?

From: Atul Ashar <aka_at_ulysses.att.com>
Date: 1995/12/01
Message-ID: <DIx85u.2y3_at_ulysses.homer.att.com>#1/1


There is a thumb rule for using NULLABLE columns. If default value of you column can be valid value then make that column nullable. As you said nullable columns have overheads both from programmers' and users' point of view. There are some arguments about space usage but I think we are in age where few bytes (though per records) does not make much of difference (in almost all the cases. No flames please !!!). I feel it is better to avoid using nulls unless it is necessary.

Let's take some examples.

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. However, let's say for wkly_sales like column, if it is not nullable then 0 can be 0 sales figure or not available and hence it is better to define such columns as nullable.

Other difference is in case if you are using average function. Average does not consider null value columns for calculating average.

francois.lachance_at_sasknet.sk.ca (Francois Lachance) wrote:
>We have a few tables with numeric columns. By default, if you don't
>save a value in those columns, they are NULL values. Is there an
>advantage to leaving these empty rows as NULL? Users that are doing
>queries directly against the database are asking that Zero be put in
>the rows where no value has been specified. Programmers find it
>annoying to have to make sure that calculations are not done on NULL
>values since it returns a NULL if you do.
Received on Fri Dec 01 1995 - 00:00:00 CET

Original text of this message