wang01 发表于 2007-10-30 08:36:12

老问题新问(列顺序)

如何在指定位置插入字段,一般添加字段是在未尾!!!
谢谢指点!!!!!!!!!!!!!!!!!!!!!!!!!

kider 发表于 2007-10-30 09:02:10

在加入新字段的语句之后追加 After关键字即可:
alter table tablename add column colname columntype after column;

wang01 发表于 2007-10-30 12:12:44

alter table news add column ID int(11) after column;
alter table news add column ID int(11) after 1;
alter table news add column ID int(11) after column 1;
好象都不成功
alter table news add column ID int(11) after columname; 成功
谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[ 本帖最后由 wang01 于 2007-10-30 12:16 编辑 ]

wang01 发表于 2007-10-30 12:17:50

谢谢kider!!!!!!!!!!!!!!!!

wang01 发表于 2007-10-30 12:41:05

在之前插入又有问题

alter table news add column ID int(11) first columname;

edwin_chen 发表于 2007-10-30 15:30:08

原帖由 wang01 于 2007-10-30 12:41 发表 http://www.mysqlpub.com/images/common/back.gif
alter table news add column ID int(11) first columname;

正确用法是: alter table news add column ID int(11) first ;

含义是:增加的新列作为第一列,而不是在那列之前增加新列。

kider 发表于 2007-10-30 15:35:04

:victory: 理解的够深刻,牛...
页: [1]
查看完整版本: 老问题新问(列顺序)