PostgreSQL – Delete Column

To delete one or more columns of a PostgreSQL table, run the following ALTER TABLE command.

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.

ADVERTISEMENT
PostgreSQL Delete Column - Example

Run the following ALTER TABLE query to delete attendance column from students table.

ALTER TABLE students 
	DROP COLUMN attendance;
PostgreSQL Delete Column - ALTER COLUMN DROP

Let us check the contents of the table using SELECT query, if the column is deleted or not.

PostgreSQL After dropping column

Summary

In this PostgreSQL Tutorial, we have deleted a column from PostgreSQL table. You can repeat the process to delete multiple columns.