一、表中增加一列
alter table 要修改的表名 add(要添加的列 该列数据类型 [default 默认值]);
二、表中删除一列
alter table 表名称 drop column 列名称;
三、修改表中列的数据类型
alter table 表名称 modify(列名称 列数据类型 [default 默认值]);
注意点:
1、如果是更改数据的长度,则要求更改时,长度不能小于当前表中数据所具有的最大长度
2、如果是更改数据类型,则要求更改时,该列的所有记录值都为空
四、为表重命名
rename 表的原表名 to 表的新表名;
五、为表中的列重命名
alter table 表名称 rename column 列名称 to 新的列名称;
六、为表添加注释
comment on table 表名称 is ‘要注释的内容’;
七、为表中的列添加注释
comment on column 表名称.列名称 is ‘要注释的内容’;
八、截断表
truncate table 表名称;
该操作是清空表数据,会立即释放资源,且不可回滚
九、删除表
drop table 表名称;