【发布时间】:2011-09-30 19:58:45
【问题描述】:
我读到mysql中的bool类型是tinyint(1)的别名,所以我应该使用tinyint
我的问题如下: 我是否需要声明它未签名,我的意思是,有必要吗?
purchased tinyint(1) unsigned not null DEFAULT 0,
or
purchased tinyint(1) not null DEFAULT 0,
【问题讨论】:
-
你在使用BOOL有什么问题吗?
-
"因此我应该使用 tinyint" - 为什么会这样呢? BOOL 非常好,(在我看来)更能表达你的意图。
TINYINT(1)可能意味着“从 0 到 9”;BOOL特指“0 或 1”(尽管我想你可能歪曲了你的意图:-))。