mysql5.5默认值问题

gabriel1017 2014-06-06 08:39:12
...全文
218 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
gabriel1017 2014-10-23
  • 打赏
  • 举报
回复
谢谢!是自己太粗心了,用惯了 postgresql 回头用mysql就想当然了,给分!
ACMAIN_CHM 2014-06-07
  • 打赏
  • 举报
回复
timestamp 就是这个特性。 For some data types, MySQL handles NULL values specially. If you insert NULL into a TIMESTAMP column, the current date and time is inserted A TIMESTAMP column is useful for recording the date and time of an INSERT or UPDATE operation. By default, the first TIMESTAMP column in a table is automatically set to the date and time of the most recent operation if you do not assign it a value yourself. You can also set any TIMESTAMP column to the current date and time by assigning it a NULL value. Variations on automatic initialization and update properties are described in Section 10.3.1.1, “TIMESTAMP Properties”. TIMESTAMP columns are NOT NULL by default, cannot contain NULL values, and assigning NULL assigns the current timestamp. However, a TIMESTAMP column can be allowed to contain NULL by declaring it with the NULL attribute. In this case, the default value also becomes NULL unless overridden with a DEFAULT clause that specifies a different default value. DEFAULT NULL can be used to explicitly specify NULL as the default value. (For a TIMESTAMP column not declared with the NULL attribute, DEFAULT NULL is illegal.) If a TIMESTAMP column allows NULL values, assigning NULL sets it to NULL, not to the current timestamp.
gabriel1017 2014-06-06
  • 打赏
  • 举报
回复
如果我需要它报错怎么办?
使用说明: ===================================================================================================== 命令行自动安装脚本: mysql_install.bat的简单用法 确定一个完整的版本号,比如:5.6.14, 5.1.72, 5.5.34, 如何确定, 访问网址: http://download.softagency.net/MySQL/Downloads/MySQL-/ (主版本号为5.1, 5.6, 5.5之类) 找到win32.zip, 或者winx64.zip结尾的文件名,比如:mysql-5.5.34-win32.zip, 中间的串:5.5.34就是 完整的版本号. 选定是32位的, 还是64位的,32位用win32, 64位的用winx64, 默认为32位。 命令行用法: mysql_install.bat [arch] [ROOTDIR] [server_port] 参数: fullversion, 必须指定, 如5.6.14, 5.1.72, 4.1.22, 5.5.34, 6.0.11-alpha等等 arch, 可选,不指定时,为win32, 有效值可以是win32或者winx64 ROOTDIR, 可选,安装的最终根目录,默认值为d:, 不用带后边的"\".此目录必须事先存在或创建好 server_port, 可选,默认值为3306. 最终生成的服务名为: iihero- 如果你想卸载,也非常简单,先用sc delete iihero- 接着进到%ROOTDIR%\%MYSQL_HOME%, 直接删除整个目录就可以了. 非常方便。 也请尊重个人劳动。 http://blog.csdn.net/iihero/article/details/5596401 有相关的描述。 有什么问题,欢迎联系:iiihero AT hotmail.com http://blog.csdn.net/iihero http://blog.chinaunix.net/uid/40286.html http://blog.chinaunix.net/topic/hexiong/ ===================================================================================================== 示例: :: mysql_install.bat 4.1.22 :: mysql_install.bat 5.0.95 winx64 :: mysql_install.bat 5.6.14 winx64 :: mysql_install.bat 5.1.72 winx64 :: mysql_install.bat 5.5.34 winx64 :: mysql_install.bat 6.0.11-alpha win32

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧