actually ur this sql query only insert a new column at the end of the table
所在版块:求学狮城 发贴时间:2004-05-14 09:25

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
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!
 相关帖子 我要回复↙ ↗回到正文
MySQL "alter table" syntax got problem 喔喔   (309 bytes , 533reads )
alter table my_table add column my_colunm varchar(eg) default "default"; MrDJay   (0 bytes , 251reads )
actually ur this sql query only insert a new column at the end of the table 喔喔   (799 bytes , 214reads )
ic, sorry MrDJay   (104 bytes , 161reads )