db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leslie Software <lesliesoftw...@yahoo.com>
Subject Re: Best choice for column's data type to represent boolean data
Date Thu, 07 Dec 2006 14:07:18 GMT
Thanks for the advice I was leaning towards the numeric solution but using 'T' / 'F' as a visual
clue makes a lot of sense.  After all until we do have a new boolean data type that visual
clue is all we have.  I am already looking forward to the next version:-)

Ian

----- Original Message ----
From: "derby@segel.com" <derby@segel.com>

Well the best practice would be to extend the known data types to include a
Boolean. ;-)

There are two options.
You can create a CHAR(1) column, or if the database you could do a
byte/short column as well. 

If you use a CHAR(1) you could represent the Boolean as either ('T' or 'F')
or ('Y','N'). You would also want to put a check constraint on the column
only allowing a true and a false value.

You could also use a 1 or a 0 in the column as well and provide the same
check constraint, however using a T/F or Y/N provides a visual cue that
would be missing from a numeric solution.

HTH

-G







__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message