mysql添加一列,並設置自增


在數據庫中添加一列,並設置自增

 

注意設置自增時要將該字段設置為主鍵,如果不指定插入位置則默認為列名的最后。

1 alter table test.student add column indexxx int(14) primary key auto_increment;

 

指定插入在某一列之后

 1 alter table test.student add column indexxx int(14) primary key auto_increment after 列名; 

 

指定插入到第一列

 1 alter table test.student add column indexxx int(14) primary key auto_increment after first; 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM