PostgreSQL – Delete Column
To delete one or more columns of a PostgreSQL table, run the following ALTER TABLE command.
</>
Copy
ALTER TABLE tablename
DROP COLUMN column_name;
Example 1 – Delete a Column of PostgreSQL Table
Consider the following table. We shall delete the column named percentage.
Run the following ALTER TABLE query to delete attendance
column from students
table.
</>
Copy
ALTER TABLE students
DROP COLUMN attendance;
Let us check the contents of the table using SELECT query, if the column is deleted or not.
Summary
In this PostgreSQL Tutorial, we have deleted a column from PostgreSQL table. You can repeat the process to delete multiple columns.