PG重命名表字段及表名
来源:互联网 发布:js常用调试工具 编辑:程序博客网 时间:2024/04/29 01:30
PG重命名表字段:
highgo=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+------------
id | integer | default 10
no | text |
highgo=# alter table test rename column no to name;
ALTER TABLE
highgo=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+------------
id | integer | default 10
name | text |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PG重命名表名:
highgo=# select * from test;
id | name
----+------
15 | 1
15 | 2
15 |
15 | 1
(4 rows)
highgo=#
highgo=#
highgo=#
highgo=# alter table test rename to t;
错误: 关系 "t" 已经存在
highgo=# alter table test rename to test_new;
ALTER TABLE
highgo=# select * from test;
错误: 关系 "test" 不存在
LINE 1: select * from test;
^
highgo=# select * from test_new;
id | name
----+------
15 | 1
15 | 2
15 |
15 | 1
(4 rows)
highgo=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+------------
id | integer | default 10
no | text |
highgo=# alter table test rename column no to name;
ALTER TABLE
highgo=# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+------------
id | integer | default 10
name | text |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PG重命名表名:
highgo=# select * from test;
id | name
----+------
15 | 1
15 | 2
15 |
15 | 1
(4 rows)
highgo=#
highgo=#
highgo=#
highgo=# alter table test rename to t;
错误: 关系 "t" 已经存在
highgo=# alter table test rename to test_new;
ALTER TABLE
highgo=# select * from test;
错误: 关系 "test" 不存在
LINE 1: select * from test;
^
highgo=# select * from test_new;
id | name
----+------
15 | 1
15 | 2
15 |
15 | 1
(4 rows)
阅读全文
0 0
- PG重命名表字段及表名
- sql server 重命名表字段
- 根据表名获取表字段信息
- 修改表名,修改表字段
- Access建表中对表字段及表名的关键字使用注意事项
- 根据表名和模板GGUID,得到表字段 及清单信息
- sql 删除表字段约束及字段名
- 【oracle】 表名,表字段,表空间等的操作
- sql 查询所有数据库、表名、表字段总结
- 获取oracle 表字段,表名,以及主键之类信息
- sql 查询所有数据库、表名、表字段总结
- powerdesigner 不显示表字段只显示表名
- sql ---查询所有数据库、表名、表字段总结
- sql 查询所有数据库、表名、表字段总结
- SQL 查询所有数据库,表名,表字段总结
- sql 查询所有数据库、表名、表字段总结
- sql 查询所有数据库、表名、表字段总结
- Sql Server 表名、表字段与关键字冲突
- 117. Populating Next Right Pointers in Each Node II
- Linux学习笔记
- C#中Math.Round()函数的简单解析
- bzoj1044 [HAOI2008]木棍分割
- Android内存优化(一)
- PG重命名表字段及表名
- 机器学习技法课程学习笔记5-- Kernel Logistic Regression
- hhhhhh
- 【转】数据库基本知识:(六)多个数据表的连接
- oracle 事务流程
- java之split用法注意
- C++例子
- 都什么时代了,你只会ssh么?
- php支付相关