![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to create a table that has a column that will ONLY accept TRUE or FALSE (0 or 1). If I set the type to BOOL, then it will accept any value that will fit into a tinyint. If I set the type to ENUM and only allow 0 or 1, MySQL insists on allowing 3 values - NULL, 0, & 1, even if null is not allowed for the column. |
|
a | +---+ | +---+ |
#3
| |||
| |||
|
|
mysql> insert into t values(3); Query OK, 1 row affected, 1 warning (0.00 sec) mysql> select * from t; +---+ | a | +---+ | | +---+ So your "a" column can take 3 values: 0, 1 and ''. OP wanted to get only 2 values. |
![]() |
| Thread Tools | |
| Display Modes | |
| |