postgresql 如何在postgresql中删除多列

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13474537/
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 23:51:11  来源:igfitidea点击:

How to drop multiple columns in postgresql

postgresql

提问by f.ashouri

I want to drop 200 columns in my table in PostgreSQL. I tried:

我想在 PostgreSQL 的表中删除 200 列。我试过:

ALTER TABLE my_table
DROP COLUMN col1, col2

But I get an error like this:

但我收到这样的错误:

ERROR: syntax error at or near "col2"

错误:“col2”处或附近的语法错误

回答by long

Check this:

检查这个:

ALTER TABLE table DROP COLUMN col1, DROP COLUMN col2;

回答by timxor

This worked for me:

这对我有用:

alter table your_table_name drop column your_column_name;