08/10: MySQL > Handling Invalid Values in Non-Strict Mode
Category: Study
Posted by: hajime osako
If MySQL is not operating in strict mode, it adjusts invalid input values to legal values when possible and generates warning messages.
For a single-row INSERT which is assigning NULL to a NOT NULL column, an error occurs and the statement fails. However, for a multiple-row INSERT, MySQL assigns the column the implicit default value for its data type.
If a column is changed to NOT NULL using ALTER TABLE, MySQL converts NULL values to the implicit default value for the data type. (Warning but No error!)
For a single-row INSERT which is assigning NULL to a NOT NULL column, an error occurs and the statement fails. However, for a multiple-row INSERT, MySQL assigns the column the implicit default value for its data type.
If a column is changed to NOT NULL using ALTER TABLE, MySQL converts NULL values to the implicit default value for the data type. (Warning but No error!)