简体   繁体   中英

mysql not null & allow null difference

I am a mysql beginner, maybe it is a silly question, so don't laugh at me :) I am currently reading a book and confused about the following sentence:

NOT NULL means that all the rows in the table must have a value in the attribute, if it isn't specified, the field can be blank (NULL)

So, even you set a column to not null, you don't have to specify a value to it? Then it become blank(null)? Then what is the difference between not null and allow null? Is the book wrong?

The "if it isn't specified" refers to "NOT NULL" - not the value. So it would have been clearer as:

NOT NULL means that all the rows in the table must have a value in the attribute. If NOT NULL isn't specified, the field can be blank (NULL)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM