How can we remove a column from MySQL table?

MySQLMySQLi Database

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.

raja
Published on 19-Feb-2018 08:37:17
Advertisements