📜  没有默认值 mysql 代码示例

📅  最后修改于: 2022-03-11 15:05:17.799000             🧑  作者: Mango

代码示例1
# Option 1: Change table schema and add a DEFAULT to the column
ALTER TABLE 'Foo' 
CHANGE COLUMN 'bar' 'bar' INT(11) NOT NULL DEFAULT 0 ;

# Option 2: Turn off strict trans tables
SELECT @sql_mode:=@@GLOBAL.sql_mode;
SET @new_sql_mode:= REPLACE(@sql_mode,',STRICT_TRANS_TABLES','');
SET GLOBAL sql_mode=@new_sql_mode;
# May need to restart service if changes don't immediately take affect