postgresql 字段sql语句 更改表名

前端之家收集整理的这篇文章主要介绍了postgresql 字段sql语句 更改表名前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.更改表名

alter table 表名 rename to 新表名

2.更改字段名

alter table 表名 rename 字段名 to 新字段名

3,更改字段类型

如:ID 字段 原类型为 character varying(50) 新类型为integer

其中,ID中原有数据为1,2,3等数字

用如下语句更改

alter table dbo.titemtype alter column id type integer using to_number(id,'9');

猜你在找的Postgre SQL相关文章