Home > Article > Backend Development > NOT NULL and NULL_PHP Tutorial
NOT NULL | NULL: Specifies whether the column is allowed to be empty. If neither NULL nor NOT NULL is specified, the column is considered to have NULL specified. Automatically convert the NULL value into the default value of the field,
Even if you did not explicitly set a default value for the field when defining the table
:> Generally speaking, MySQL will automatically add a default value for you.
For example
Assign NULL value to a NOT NULL integer type,
The result is 0
CHAR type
-> ''null value
DATATIME
->'0000-00-00 00:00:00'
Wait
Top
2F UNICORN_BX (天天天蓝) replied on 2003-01 -13 11:22:18 Score 0 In other words, NOT NULL is not a constraint in MySQL.
If a field is set to NULL, then there is no value given to the field when inserting the record, then MySQL automatically Use the value of Default. If there is no Default, no matter what type the field is, the field value is NULL.
Is this the role of NOT NULL and NULL in MySQL, that is, when Default is not defined value, the default value given is different.
http://www.bkjia.com/PHPjc/317810.html
www.bkjia.com