SQL: set existing column as Primary Key in MySQL

前端 未结 5 917
北恋
北恋 2021-01-31 13:23

I have a database with 3 columns:

id, name, somethingelse  

This table has no index set and i am getting \"No index defined!\" in phpmyadmin

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 13:55

    alter table table_name
    add constraint myprimarykey primary key(column);
    

    reference : http://www.w3schools.com/sql/sql_primarykey.asp

提交回复
热议问题