UpH*_*lix 4 mysql database alter-table
我正在尝试在另一列之后添加一列,同时还指定一个默认值.以下是我的尝试不起作用.
alter table pageareas add content_userDefined BIT( 1 ) NULL default 0 after content;
Run Code Online (Sandbox Code Playgroud)
如果我删除"内容后"它的工作原理:
alter table pageareas add content_userDefined BIT( 1 ) NULL default 0;
Run Code Online (Sandbox Code Playgroud)
如果我删除"默认0"它的工作原理:
alter table pageareas add content_userDefined BIT( 1 ) NULL after content;
Run Code Online (Sandbox Code Playgroud)
如何在指定列之后添加它,同时还定义默认值?
我正在使用MySql 5.1.36
如果我这次正确阅读文档alter table ...你只能指定after或者default两者都指定.您可以通过使用创建列来解决此问题after,然后将其更改为具有以下内容default:
alter table pageareas add content_userDefined BIT( 1 ) NULL after content;
alter table pageareas alter content_userDefined set default 0;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9198 次 |
| 最近记录: |