Not NULL and null_php tips

Source: Internet
Author: User
Not NULL | Null: Specifies whether the column is allowed to be empty. If NULL is not specified and NOT NULL is specified, the column is considered to specify NULL
In MySQL,
Sets a null value for a not NULL field.
It's not going to go wrong,
MySQL automatically converts the null value to the default value of the field.
I'm afraid you didn't explicitly set the default value for the field when the table was defined
: "In general, MySQL will automatically add the default value for you,

Like what
Assigns a null value to an integral of not NULL.
The result is 0.

CHAR type
-> ' null value

Datatime
-> ' 0000-00-00 00:00:00 '

Wait a minute
Top

2 floor unicorn_bx (every day sky blue) reply to 2003-01-13 11:22:18 score 0 that is, not NULL in MySQL is not a constraint.

If the field is set to NULL, the value of the field is not given when the record is inserted, then MySQL automatically uses the value of default, and if there is no default, the field value is null regardless of what type the field is.

This is not the effect of NOT null and NULL in MySQL, that is, when the default value is not defined, the defaults are given differently.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.