Re: The BOOLEAN data type

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 2 Apr 2003 17:35:41 -0800
Message-ID: <c0d87ec0.0304021735.753e42b0_at_posting.google.com>


>> Why is it bad? <<

In the old days of unit record equipment (aka "punch cards"), you had to put data in the fields and then run the deck thru various machines to sort and tabulate them. One of the standard machines did computations and punched the results into columns in the same card. Usually, it was things like "(quantity * price) = extension".

This sytle of programming carried over to magnetic tapes and into sequential files. We would compute and record the total of the order details in a header record and often a flag was set to record the state of the group in that record -- say the total order was high enough to qualify for a discount, so we set a bit.

If an order item changed, you had problems and had to go back and re-set the flags. Eventually, the flag would get out of synch with the set of records that it was supposed to summarize. Opps!

So when we got to RDBMS systems, we tried to get rid of redundancies like that with normalization.

>>I'm working on a project where we store people's gender - what's
wrong
with using a boolean for that? <<

There is an ISO Standard code for gender and you should use Standards whenever they exists.

0= unknown
1= male
2= female
9= N/A, lawful person such as a church, school, corporation

Gender is not a flag; it is an attribute. A flag reports a state, an attribute takes a value. Received on Thu Apr 03 2003 - 03:35:41 CEST

Original text of this message