更改表列错误添加2列

Fof*_*ole 2 postgresql

数据库:在PostgreSQL

我有一个表location_type,其中包含2列id,name.我想删除列名并添加2个其他列:county,city.但是我得到错误,我无法弄清楚为什么.这是我试过的:

ALTER TABLE location_type
DROP COLUMN name;

ALTER TABLE location_type
ADD (county character varying(255) NOT NULL,
     city character varying(255) NOT NULL);
Run Code Online (Sandbox Code Playgroud)

也许有人可以看到我做错了什么.任何建议表示赞赏.谢谢.

Erk*_*lat 5

你的语法错了.试试这个[Doc]:

ALTER TABLE location_type
    ADD county character varying(255) NOT NULL,
    ADD city character varying(255) NOT NULL;
Run Code Online (Sandbox Code Playgroud)