postgresql 如何在 Postgres 的表中添加多列?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5260697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 22:51:28 来源:igfitidea点击:
How to add multiple columns to a table in Postgres?
提问by Hick
How do I add multiple columns in one query statement in PostgreSQL using pgadmin3?
如何使用 pgadmin3 在 PostgreSQL 的一个查询语句中添加多列?
回答by Erkan Haspulat
Try this :
尝试这个 :
ALTER TABLE table ADD COLUMN col1 int, ADD COLUMN col2 int;
回答by RaM PrabU
ALTER TABLE IF EXISTS TABLEname
add ADD COLUMN IF NOT EXISTS column_name data_type [column_constraint];
detailed query where column_constraints are optional
详细查询,其中 column_constraints 是可选的