sql - In a MySQL db, how to add a new column and make it a primary key? -


in mysql db, how add new column , make primary key? db has 4 columns, 1 of primary key.

alter table foo add column bar int, drop primary key, add primary key(bar); 

better run in 1 query if table large make things faster.


Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -