加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql 字段sql语句 更改表名

发布时间:2020-12-13 17:49:02 所属栏目:百科 来源:网络整理
导读:1.更改表名 alter table 表名 rename to 新表名 2.更改字段名 alter table 表名 rename 字段名 to 新字段名 3,更改字段类型 如:ID 字段 原类型为 character varying(50) 新类型为integer 其中,ID中原有数据为1,2,3等数字 用如下语句更改 alter table dbo

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读