【问题标题】:How to change a column name of a table in database using PSQL?如何使用 PSQL 更改数据库中表的列名?
【发布时间】:2019-01-11 12:32:31
【问题描述】:

当我使用命令时:

testing_psql_db=# alter column "phn_no" rename to phone_no;
ERROR:  syntax error at or near "column"
LINE 1: alter column "phn_no" rename to phone_no;

如何使用 PSQL 更改数据库中表的列名?

【问题讨论】:

标签: linux psql


【解决方案1】:

看文档:https://www.postgresql.org/docs/9.1/sql-altertable.html

你需要表名,正确的语法是

alter table NAME_OF_YOUR_TABLE rename column "phn_no" to phone_no;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-18
    • 1970-01-01
    • 2017-08-14
    • 2012-12-02
    • 1970-01-01
    • 1970-01-01
    • 2013-11-17
    相关资源
    最近更新 更多