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');



版权声明:本文为sq8706原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。