如何使用 PSQL 更改数据库中 table 的列名?
How to change a column name of a table in database using PSQL?
当我使用命令时:
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 更改数据库中 table 的列名?
查看文档:https://www.postgresql.org/docs/9.1/sql-altertable.html
您需要 table 名称,正确的语法是
alter table NAME_OF_YOUR_TABLE rename column "phn_no" to phone_no;
当我使用命令时:
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 更改数据库中 table 的列名?
查看文档:https://www.postgresql.org/docs/9.1/sql-altertable.html
您需要 table 名称,正确的语法是
alter table NAME_OF_YOUR_TABLE rename column "phn_no" to phone_no;