Add primary key to existing table

后端 未结 10 1571
生来不讨喜
生来不讨喜 2020-12-07 11:40

I have an existing table called Persion. In this table I have 5 columns:

  • persionId
  • Pname
  • PMid
  • Pdescription
  • Pa
10条回答
  •  不知归路
    2020-12-07 12:12

    Try using this code:

    ALTER TABLE `table name` 
        CHANGE COLUMN `column name` `column name` datatype NOT NULL, 
        ADD PRIMARY KEY (`column name`) ;
    

提交回复
热议问题