Home  >  Article  >  Backend Development  >  mysql创建表时的空值和非空值设置有什么讲究?

mysql创建表时的空值和非空值设置有什么讲究?

PHP中文网
PHP中文网Original
2016-06-23 14:03:251516browse

mysql创建表时的空值和非空值设置有什么讲究?


回复讨论(解决方案)

有人回答没????

我一般尽量不用null  
 
如果你的0和null或者''和null有不同含义, 那么就需要允许空置

这要看你的业务需求了  
空 NULL 表示什么都没有输入,也就是该数据项是无效的  
 
如果你的业务需要数据项有初值,那么就应该用 NOT NULL(不为空)并设置初值

以上就是mysql创建表时的空值和非空值设置有什么讲究?的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Statement:
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