关于sqlite中primary key可以输入null的说明
2011-02-25 10:49
127 查看
按照SQL标准, 主键(PRIMARY KEY)应该暗含NOT NULL, 不幸地是, 在SQLite中, 因为长久以来的编码疏忽, 导致 主键可以是NULL的. 我们可以修改SQLite让它符合标准(我们应该在未来这么做), 但是 SQLite使用得太广泛, 如果修正这个问题, 我们担心会搞坏一些旧有的代码. 所以,创建不能为NULL的主键时,应该使用 PRIMARY KEY NOT NULL 会比较可靠 原文如下: According to the SQL standard, PRIMARY KEY should imply NOT NULL. Unfortunately, due to a long-standing coding oversight, this is not the case in SQLite. SQLite allows NULL values in a PRIMARY KEY column. We could change SQLite to conform to the standard (and we might do so in the future), but by the time the oversight was discovered, SQLite was in such wide use that we feared breaking legacy code if we fixed the problem. So for now we have chosen to continue allowing NULLs in PRIMARY KEY columns. Developers should be aware, however, that we may change SQLite to conform to the SQL standard in future and should design new programs accordingly.
相关文章推荐
- fcitx 关于多语言,不同编码的一点说明;同时也可以用于解决fcitx不能输入问题
- 关于List中可以添加null的问题
- 关于DatagramSocket中connet()方法和getInetAddress()方法返回null的说明
- 关于指针的一些说明int*p=NULL等
- 关于是否添加索引就可以提高性能?能否举例说明
- FI--关于FI凭证字段的可见强制输入的配置说明
- 关于输入框input如何实现只可以选择不可以键盘输入
- 关于访问本站需要输入验证码的说明
- 关于null的说明以及和0的区别
- 关于RK3288_M180_红外输入_投币输入IO使用说明
- 关于androidManifest.xml中输入法窗口设置说明(windowSoftInputMode)
- alias 新的命令='原命令 -选项/参数'。举例说明,alias l=‘ls -lsh' 将重新定义 ls 命令,现在只需输入 l 就可以列目录了。
- 关于QQ号码的!文本框最多可以输入3个QQ号!
- 关于2.4内核下编译sqlite提示tcl***错误的说明
- 关于quartz可以设置为串行执行的比较详细说明
- 关于PHP-Zend framework2 框架 学习过程。 阅前须知: ZF2中的配置文件是可以静态文件配置来注册和通过相关函数动态注册。 1.EventManager(事件驱动),关于事件驱动,在ZF2相关资料没有详细说明,可以参考ANDROID的事件驱动,MFC的消息响应/事件驱动。
- 关于SQLite的创建以及使用相关说明
- 一、 找出函数中存在的问题。以下题目均在Lab05项目中完成。2、 找出项目中存在的缺陷,并给出解决的方案(至少3个,不包含下面那个举例)。 说明:这里所说的缺陷不一定都是错误,而是明显需要改进的地方。 如:不可以无限输入密码,容易被暴力破解,存在安全隐患。
- 2.5 输入一个单精度浮点数,将其向零舍入到整数。说明:向零舍入的含义是,正数向下舍入,负数向上舍入。提示:可以使用强制类型转换来实现
- 关于AD用户不输入用户名和密码直接登录网站的说明