Computer >> Computer tutorials >  >> Programming >> MySQL

How can we remove a column from MySQL table?


To drop a column from a MySQL table we can use ALTER TABLE command with DROP keyword. The syntax is as follows

Alter Table table_name DROP Column Column_name;

Below 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 query above will drop the column name ‘class’ from ‘student’ table.