mysql学习笔记02

上一篇 / 下一篇  2015-12-14 20:20:41 / 个人分类:数据库

修改表

1.   新增列在表的最后

Alter table表名add列名列类型列参数

Egalter table bookinfo add category vachar(8) not null default ‘’;

2.   新增列在某列之后

Alter table表名add列名列类型列参数after某列

Egalter table bookinfo add issuedate date not null default ‘0000-00-00’ after bookauthor;

3.   新增列在表的最前面

Alter table表名add列名列类型列参数first

 Egalter table bookinfo add press vachar(8) not null default ‘’ first;

4.   删除列

Alter table表名drop列名

5.   修改列类型

Alter table表名modify列名新列类型新列参数

Eg: alter table bookinfo add press vachar(8) not null default ‘’ first;

6.   修改列名及列类型

Alter table表名change旧列名新列名新列类型新列参数

Egalter table bookinfo change bookprice price decimal(5,2) not null default 0.00;


TAG: MySQL mysql

fhhh_eyou的个人空间 引用 删除 fhhh_eyou   /   2015-12-15 11:07:43
多学习学习知识很好,谢谢!
fhhh_eyou的个人空间 引用 删除 fhhh_eyou   /   2015-12-15 11:07:03
1
 

评分:0

我来说两句

我的栏目

日历

« 2024-04-19  
 123456
78910111213
14151617181920
21222324252627
282930    

我的存档

数据统计

  • 访问量: 2150
  • 日志数: 3
  • 建立时间: 2015-12-11
  • 更新时间: 2015-12-15

RSS订阅

Open Toolbar