MySQL "alter table" syntax got problem
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 2 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:喔喔 (等级:2 - 初出茅庐,发帖:36) 发表:2004-05-12 16:06:06  楼主  关注此帖
MySQL "alter table" syntax got problem
I am trying to add a column into an existing table using

ALTER TABLE table_name ADD COLUMN column_name column_definition FIRST another_column

the FIRST keyword got syntax error.

btw, i am using MySQL 4

Could anyone help to solve this problem?
Put your OWN COOL signature here!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:喔喔 (等级:2 - 初出茅庐,发帖:36) 发表:2004-05-14 09:25:02  2楼
alter table my_table add column my_colunm varchar(eg) default "default";
actually ur this sql query only insert a new column at the end of the table
what i want is to insert a new column at the beginning of the table.

And, i just found out that there is no problem with the keyword "FIRST" at all. I read the manual wrongly yesterday.

======================
ALTER [IGNORE] TABLE tbl_name alter_specification [, alter_specification] ...

alter_specification:
ADD [COLUMN] column_definition [FIRST | AFTER col_name ]
....
.....
=======================
So, to add a column at the beginning of the table, use "alter table my_table add column my_colunm column_definition FIRST". To add a column at any other place rather than the beginning of the table, use "table my_table add column my_colunm column_definition AFTER clolumn_B"
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 求学狮城 | 返回上一页 | 本主题共有 2 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码