i2tutorials

MySQL – Delete Column

MySQL – Delete Column

MySQL - Delete Column

In some cases, we may want to remove a single column or multiple columns from a table. The ALTER TABLE DROP COLUMN statement allows you to delete a column from the table.

Syntax:

ALTER TABLE table_name  DROP COLUMN column_name;  

Example

ALTER TABLE employees  DROP COLUMN city;

We can remove multiple columns from the table by executing the following command:

Syntax:

ALTER TABLE table_name  
DROP COLUMN column_1,  
DROP COLUMN column_2,  
......;  

Example

ALTER TABLE employees  
DROP COLUMN country,  
DROP COLUMN age;

 

Exit mobile version