List:General Discussion« Previous MessageNext Message »
From:J.R. Bullington Date:June 13 2005 2:47pm
Subject:alter table - add a column
View as plain text  
Alter table foo drop Primary Key

Alter table add `userid` int(8) first

Alter table add Primary Key `userid`


Those 3 statements should do it. However, knowing the people on this list,
they will have a faster and better way than mine.

Don't forget about the manual as well...

http://dev.mysql.com/doc/mysql/en/alter-table.html

J.R.


-----Original Message-----
From: bruce [mailto:bedouglas@stripped]
Sent: Monday, June 13, 2005 10:30 AM
To: mysql@stripped
Subject: alter table - add a column

hi..

i have a table that i want to add a column to, and define the columm to be
the primary key. however, i already have a column in the table that's used
as the primary. can someone tell me the approach/commands i should use to
get my results?

table foo
username varchar(50), primary

what i want...
userid int(), primary
username varchar(50)

with userid listed before username!!
can someone tell me what the commands are that i need to enter to get this!!

i thought something like,
alter table foo add userid int(8), primary first (but i couldn't get it to
work.. errors) and then i couldn't see how to remove the primary key fom
username...

thanks

-bruce
bedouglas@stripped



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1


Attachment: [application/x-pkcs7-signature] smime.p7s
Attachment: [application/x-pkcs7-signature] smime.p7s
Thread
alter table - add a columnJ.R. Bullington13 Jun