Can Primary Key be added with ALTER?

Can Primary Key be added with ALTER?

am 26.10.2006 18:46:16 von murthy gandikota

--0-445283622-1161881176=:77106
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi
I have a table with no primary key. I'd like to make one of the table columns as the primary key. Is it possible do it with ALTER? Is there any other way?

Many thanks for your help.
Murthy

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--0-445283622-1161881176=:77106--

Re: Can Primary Key be added with ALTER?

am 26.10.2006 18:50:53 von Peter Brawley

> I have a table with no primary key. I'd like to
>make one of the table columns as the primary key.
>Is it possible do it with ALTER? Is there any other way?

ALTER TABLE tblname ADD PRIMARY KEY (colname);

PB


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.13/500 - Release Date: 10/26/2006


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