How to: MySQL Delete Column

To delete a column from a MySQL table, you can use the ALTER TABLE statement with the DROP COLUMN clause. Here’s the basic syntax:

ALTER TABLE table_name
DROP COLUMN column_name;

Replace table_name with the name of the table from which you want to delete the column, and replace column_name with the name of the column you want to delete.

For example, let’s say you have a table called employees and you want to delete the phone column. Here’s the SQL statement you would use:

ALTER TABLE employees
DROP COLUMN phone;

This statement will delete the phone column from the employees table.

Note that once you delete a column, you cannot recover the data in that column. If you want to keep the data, make sure to back it up before deleting the column.

Leave a Comment