Create boolean column in MySQL with false as default value?

后端 未结 4 967
醉梦人生
醉梦人生 2021-01-30 04:32

I want to create a table in MySQL with a boolean column whose default value is false. But it\'s accepting NULL as default...

4条回答
  •  醉梦人生
    2021-01-30 05:22

    Use ENUM in MySQL for true / false it gives and accepts the true / false values without any extra code.

    ALTER TABLE `itemcategory` ADD `aaa` ENUM('false', 'true') NOT NULL DEFAULT 'false'
    

提交回复
热议问题