Hi Paul,

ALTER TABLE table_name ADD id_column_name INT UNSIGNED NOT NULL
AUTO_INCREMENT PRIMARY KEY FIRST;

The FIRST word at the end just makes it the first column in the table if
that's what you want.


Hope that helps.


Matt


----- Original Message -----
From: "Paul Maine"
Sent: Thursday, February 26, 2004 7:08 PM
Subject: HOWTO add Primary Key to Existing Table


> How can I add an auto-incrementing primary key to an existing table?
>
> MySQL version 4.0
>
> Thank You


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to