In this article, you will learn how to drop or delete a single column or multiple columns from an existing table in MySQL. Sometimes, you need to remove a single or multiple unused or obsolete columns from an existing table. To do this, you need to follow the syntax as given below:
ALTER TABLE table_name
DROP COLUMN column_name;
Where,
If you want to delete more than one column at once, here is the syntax for deleting multiple columns.
ALTER TABLE table_name
DROP COLUMN column_name_1, 
DROP COLUMN column_name_2
…;
This SQL statement creates a new table named Employee in the Database:
CREATE TABLE Employee(
    id INT PRIMARY KEY,
    first_name VARCHAR(255) NOT NULL,
    last_name VARCHAR(255) NOT NULL,
    date_of_birth DATE NOT NULL,
    phone VARCHAR(25),
    email VARCHAR(255),
    city  VARCHAR(255)
);
The following statement drops the city column from the Employee table:
ALTER TABLE Employee
DROP COLUMN city;
The following statement drops the date_of_birth, phone, email column from the Employee table:
ALTER TABLE Employee
DROP COLUMN date_of_birth,
DROP COLUMN phone,
DROP COLUMN email;
I hope this article will help you to understand how to drop or delete a single column or multiple columns from an existing table in MySQL.
Share your valuable feedback, please post your comment at the bottom of this article. Thank you!
Comments