MySQL如何创建主键?Alter table add PRIMARY KEY的用法和例子

  1. -- 创建一个无主键的表格  
  2. create table testNoPK (  
  3.   id int not null,  
  4.   name varchar(10)  
  5.  );  
  6.    
  7. -- 创建索引  
  8.  alter table testNoPk   
  9.    add primary key PK_testNoPK (id);  

alter table tb_name change add add int(10) not null auto_increment primary key;


出处:https://blog.csdn.net/u011742227/article/details/14214121

猜你喜欢

转载自blog.csdn.net/jackliu16/article/details/80725010