Add & Arrange New Column

Add & Arrange New Column

am 17.09.2010 16:34:02 von Carlos Williams

I have an existing table with a few columns I created a few months
ago. Sadly I left out the column I would like to use for my Primary
Key and wanted to know what is the best way to add a column to an
existing table but also I want the column to appear first before any
other columns since it's the 'id' column and will be set to PRIMARY
KEY NOT NULL.

Thanks for any assistance.

-Carlos

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Add & Arrange New Column

am 17.09.2010 16:50:11 von joao

alter table "mytable" add id int not null primary key auto_increment first;

I hope it can help you.

--
João Cândido de Souza Neto

"Carlos Mennens" escreveu na mensagem
news:AANLkTikfC89rHErcRg5PR9YXFV8SEmVdV4KP9r67ngV=@mail.gmai l.com...
>I have an existing table with a few columns I created a few months
> ago. Sadly I left out the column I would like to use for my Primary
> Key and wanted to know what is the best way to add a column to an
> existing table but also I want the column to appear first before any
> other columns since it's the 'id' column and will be set to PRIMARY
> KEY NOT NULL.
>
> Thanks for any assistance.
>
> -Carlos



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org