数据库 - mysql boolean型无法插入true
巴扎黑
巴扎黑 2017-04-17 16:26:44
0
5
745

mysql设置boolean型会转为tinyint(1)
在我本地的mysql上,我插入一个true,会自动转为1,插入到数据库,但是在我服务器上却不行。
不知道是版本问题还是配置问题,请教一下大神

巴扎黑
巴扎黑

reply all(5)
小葫芦

Is it true that when assigning a value, it is treated as a string with quotes?

巴扎黑

左手右手慢动作

If you write the SQL statement directly, it is better to write 0,1...

INSERT INTO ... VALUES(1);
迷茫

As a programmer, you should be very sensitive to true/false, non-0 is true

阿神

BOOLEAN is equivalent to TINYINT(1)

These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values ​​are considered true

Use ENUM('false', 'true') NOT NULL DEFAULT 'false' to store true

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template