PostgreSQL - How to drop multiple columns in a table?
How to drop multiple columns in a PostgreSQL table?
1. Using SQL Query:
You can drop multiple columns in a table by running this ALTER TABLE statement:
ALTER TABLE table_name
DROP COLUMN col1,
DROP COLUMN col2,
...
;
2. Using TablePlus GUI Tool:
In TablePlus, you can drop multiple columns of a table via the GUI tool:
- Select the table to open it
- Switch to structure tab by clicking on the Structure button at the bottom of the window, or use shortcut keys Cmd + Ctrl + ].
- Select the columns and press Delete key, or right click and select Delete
- Hit Cmd + S to commit changes to the server.
Need a good GUI tool for PostgreSQL? Check out TablePlus. It’s native, beautiful, and available for free.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS