NOT NULL and NULL_PHP Tutorial

WBOY
Release: 2016-07-21 15:57:32
Original
1077 people have browsed it

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

http: //www.bkjia.com/PHPjc/317810.htmlTechArticleNOTNULL|NULL: Specifies whether the column is allowed to be empty. If neither NULL nor NOTNULL is specified, the column is considered to have NULL specified. In MySQL, setting a NULL value for a NOTNULL field does not...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!