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

PHP中文网
Release: 2016-06-23 14:03:25
Original
1513 people have browsed it

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


回复讨论(解决方案)

有人回答没????

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

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

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


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!