MySQL "alter table" syntax got problem
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 4 楼,当前显示第 3 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:喔喔 (等级:2 - 初出茅庐,发帖:36) 发表:2004-05-14 09:25:02  3楼 
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"
Put your OWN COOL signature here!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

本帖共有 4 楼,当前显示第 3 楼,本文还有 N-1 层楼,要不你试试看:点击此处阅读更多 >>



请登录后回复:帐号   密码