To delete a column from a MySQL table, we can use the ALTER TABLE command and the DROP keyword. The syntax is as follows:
Alter Table table_name DROP Column Column_name;
Here is an example to demonstrate it
mysql> Alter table student drop column class; Query OK, 5 rows affected (0.34 sec) Records: 5 Duplicates: 0 Warnings: 0
The above query will delete the column name "class" from the "student" table.
The above is the detailed content of How do we delete a column from a MySQL table?. For more information, please follow other related articles on the PHP Chinese website!