'How to drop multiple columns in postgresql
I want to drop 200 columns in my table in PostgreSQL. I tried:
ALTER TABLE my_table
DROP COLUMN col1, col2
But I get an error like this:
ERROR: syntax error at or near "col2"
Solution 1:[1]
Thanks long & Ondrej - below commands worked for me,
ALTER TABLE table_name DROP COLUMN column_name_1,DROP COLUMN column_name_2,DROP COLUMN column_name_3;
ALTER TABLE table_name DROP column_name_1,DROP column_name_2,DROP column_name_3;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Som |
