Home > Backend Development > PHP Tutorial > mysql创造表时的空值和非空值设置有什么讲究

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

WBOY
Release: 2016-06-13 11:18:19
Original
1092 people have browsed it

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

mysql
------解决方案--------------------
我一般尽量不用null

如果你的0和null或者''和null有不同含义, 那么就需要允许空置
------解决方案--------------------
本帖最后由 xuzuning 于 2013-03-21 08:16:39 编辑 这要看你的业务需求了
空 NULL 表示什么都没有输入,也就是该数据项是无效的

如果你的业务需要数据项有初值,那么就应该用 NOT NULL(不为空)并设置初值
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