Friday 23 April 2010

Creating the Primary Key on an already existing MySQL Table

ALTER TABLE tablename ADD PRIMARY KEY (columnname);

So referring back to our little table on :-
http://creating-websites-with-php-and-mysql.blogspot.com/2010/04/updating-mysql-table-row-entry.html

If we want to make the Car column the primary key we'd use:

ALTER TABLE DriverTable ADD PRIMARY KEY (Car);

No comments:

Post a Comment