----- Original Message ----- 
From: "Scott Hamm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 04, 2004 3:15 PM
Subject: True/False data type


> What data type should I use to use True/False type when I create a table?
>
MySQL 4.1.x includes a column type called Boolean which would be ideal for
what you have in mind.

In theory, a boolean has only one of two possible values: on/true/1 or
off/false/0. However, MySQLs implementation of Boolean can have any value
supported by a TINYINT(1) and treats 0 as off/false and all other values as
on/true.

If you are not using a version of MySQL prior to 4.1.x, you could simply use
a TINYINT(1) and interpret 0 as off/false and any other value as on/true.
That's not your only option of course; you could also set up a CHAR(1) and
put T for True or F for False in it. (Of course, it will be up to you to
prevent other values from being stored there. After all, how would you
interpret 'X' or '7' if you found one of those values in the column?)

Rhino


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to