Chinaunix首页 | 论坛 | 博客
  • 博客访问: 23365
  • 博文数量: 16
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 150
  • 用 户 组: 普通用户
  • 注册时间: 2015-07-11 16:41
个人简介

运维工程师+DBA

文章分类

全部博文(16)

文章存档

2015年(16)

我的朋友

分类: Mysql/postgreSQL

2015-07-14 20:52:26

1.给某字段添加索引
alter table test add index idx_id(`id`);
2.删除某表主键
alter table test drop primary key;
3.给已经存在的表添加主键
 alter table test add primary key (`id`);
4.添加自增列并设置该列为主键
 alter table test add auto_id  bigint not null auto_increment primary key;
阅读(370) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~