SQL - Delete Columns from a Table

The ALTER command is a DDL command to modify the structure of existing tables in the database by adding, modifying, renaming, or dropping columns and constraints.

Use the DROP keyword to delete one or more columns from a table.

Syntax:

ALTER TABLE table_name DROP column_name1, column_name2...;

Almost all the database supports the above syntax to delete one or more columns.

The following deletes the Address column from the Employee table in the SQL Server, MySQL, PostgreSQL, and SQLite database.

SQL Script:
ALTER TABLE Employee DROP COLUMN Address;
ALTER TABLE Employee DROP COLUMN Address, City, Pincode; -- deletes multiple columns

The following deletes a column from the Employee table in the Oracle database.

SQL Script:
ALTER TABLE Employee DROP COLUMN Address;
ALTER TABLE Employee DROP (City, PinCode); --deletes multiple columns