5 messages in com.mysql.lists.mysqlRe: enum or tinyint?
FromSent OnAttachments
dojie pornea25 Apr 2004 01:57 
Arthur Radulescu25 Apr 2004 02:25 
Michael Stassen25 Apr 2004 13:10 
Dathan Vance Pattishall25 Apr 2004 14:22 
Michael Stassen27 Apr 2004 11:02 
Subject:Re: enum or tinyint?
From:Michael Stassen (Mich@verizon.net)
Date:04/27/2004 11:02:34 AM
List:com.mysql.lists.mysql

Harald Fuchs wrote:

<snip>

Even better, in this case you can use BOOL as the column type. Although that's just a synonym of TINYINT, it makes the intended usage clearer.

I suppose, except that mysql (4.0.17, anyway) doesn't remember that you used BOOL.

mysql> CREATE TABLE bt (flag BOOL); Query OK, 0 rows affected (0.00 sec)

mysql> DESCRIBE bt; +-------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+------------+------+-----+---------+-------+ | flag | tinyint(1) | YES | | NULL | | +-------+------------+------+-----+---------+-------+ 1 row in set (0.00 sec)

mysql> SHOW CREATE TABLE bt; +-------+----------------------------------------------------+ | Table | Create Table | +-------+----------------------------------------------------+ | bt | CREATE TABLE `bt` ( `flag` tinyint(1) default NULL ) TYPE=MyISAM | +-------+----------------------------------------------------+ 1 row in set (0.00 sec)

Which is probably just as well, I think. Otherwise, you might be surprised to find that 13, for example, is a legal BOOL value.

Michael