Nullif NOT NULL and NULL

Source: Internet
Author: User
Not NULL | Null: Specifies whether the column is allowed to be empty. If neither NULL nor NULL is specified, the column is considered to have null specified
In MySQL,
Set a null value for a NOT null field,
It's not going to go wrong,
MySQL automatically converts a null value to the default value for that field.
I'm afraid you didn't explicitly set a default value for the field when the table is defined
: "In general, MySQL will automatically add default values for you,
Like what
Assigns a null value to a NOT null integer type.
The result is 0.
CHAR type
"Null value"
Datatime
' 0000-00-00 00:00:00 '
Wait a minute
Top
2 Floor unicorn_bx (daily sky blue) reply at 2003-01-13 11:22:18 score 0 That is, MySQL is not NULL 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 default value, and if there is no default, the field value is null regardless of what type the field is.
This is not the function of NOT null and NULL in MySQL, that is, when you do not define the default value, the defaults are given differently.

The above describes the Nullif not null and NULL, including the content of the nullif aspects, I hope that the PHP tutorial interested in a friend helpful.

  • 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.