PostgreSQL How to drop a column in PostgreSQL

Dropping a column in PostgreSQL is done with a single SQL statement. As an example, let's assume you have a users table and you want to drop the email column:
ALTER TABLE users DROP COLUMN email;

If the column you want to drop does not exist, PostgreSQL will throw an error. If you don't want an error, make sure the column is dropped only if it exists:
ALTER TABLE users DROP COLUMN IF EXISTS email;

Looking for a backup solution? Try Weap.io

Simple & flexible backup solution to keep your servers, websites & databases safe.

Start free trial
App screenshot