添加DATETIME列的Alter Table语法看起来像什么? [英] What does the Alter Table syntax look like for adding a DATETIME column?

查看:337
本文介绍了添加DATETIME列的Alter Table语法看起来像什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想将默认值设置为mysql表时,找不到将DATETIME列添加到mysql表中的语法是什么-示例-2011-01-26 14:30:00

I can't find what the syntax looks like for adding a DATETIME column to a mysql table when I want to set the default to - example - 2011-01-26 14:30:00

有人知道该语法是什么样吗?

Does anyone know what that syntax looks like?

这就是我所拥有的

ADD COLUMN new_date DATETIME AFTER preceding_col,

谢谢

推荐答案

如果您有疑问,请在此处解释语法 http://dev.mysql.com/doc/refman/5.5/en/alter-table.html

If you ever have doubts, the syntax is explained here http://dev.mysql.com/doc/refman/5.5/en/alter-table.html

ALTER TABLE yourTable 
  ADD COLUMN new_date DATETIME NOT NULL DEFAULT 20110126143000 AFTER preceding_col

ALTER TABLE yourTable 
  ADD COLUMN new_date DATETIME NOT NULL DEFAULT '2011-01-26 14:30:00' AFTER preceding_col

(我更喜欢数字DATETIME格式)

(I just prefer the numeric DATETIME format)

这篇关于添加DATETIME列的Alter Table语法看起来像什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆