Jump to content


Photo

Adding columns to tables in the correct place


  • Please log in to reply
1 reply to this topic

#1 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 12 March 2006 - 01:55 PM

Hi,
i want to add some columns to me table after other columns already exsistent in the table. I know the following command works:

alter table tablename add column columnname ... first;

This puts the column at the beginning of the table. How do i place it so its the third column in the table or so that it is after another column??
Thanks.

#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 12 March 2006 - 03:09 PM

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']ALtER TABLE[/span] tablename ADD newcolumn ... AFTER othercolumn [!--sql2--][/div][!--sql3--]
[a href=\"http://dev.mysql.com/doc/refman/4.1/en/alter-table.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/4.1/en/alter-table.html[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users