mysql如何在设置主键时重命名主键索引

 时间:2026-02-15 15:18:34

alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);

//增加一个新列alter table t2 add d timestamp;alter table infos add ex tinyint not null default '0';

//删除列alter table t2 drop column c;

//重命名列alter table t1 change a b integer;

//改变列的类型alter table t1 change b b bigint not null;alter table infos change list list tinyint not null default '0';

//重命名表alter table t1 rename t2;

//加索引mysql> alter table tablename change depno depno int(5) not null;mysql> alter table tablename add index 索引名 (字段名1[,字段名2 …]);mysql> alter table tablename add index emp_name (name);

//加主关键字的索引mysql> alter table tablename add primary key(id);

//加唯一限制条件的索引mysql> alter table tablename add unique emp_name2(cardnumber);

//删除某个索引mysql>alter table tablename drop index emp_name;

  • 怎么保存自己的微信二维码,分享个人明信片
  • 如何直接输入数值设置亮度?
  • 如何在流星蝴蝶剑游戏里加电脑人?
  • 残奥会香山红叶那断背景音乐是什么
  • 摩尔庄园抱抱熊怎么获得
  • 热门搜索
    韶关南雄旅游攻略 端午节英文怎么说 玫瑰花种子怎么种植 猎头公司怎么赚钱 马桶堵了如何自己快速疏通 峨眉山在哪里 分数线怎么打 淘宝联盟怎么返利 泰州旅游景点大全 淘宝图片空间在哪里