MySQL Drop Column

Profile picture for user arilio666

The following statement, ALTER TABLE DROP COLUMN, when used in MySQL, removes a whole column we specify in the query.

Syntax

ALTER TABLE table_name DROP COLUMN column_name;

Let us see in the real-time example.

For a real-time example, we are going to use the crypto_price_list table.

how to drop a column in mysql

MySQL Drop Column Example 

Dropping Year Column

ALTER TABLE crypto_price_list DROP COLUMN Year;

how to drop column in mysql

We can see that the requested column 'Year' has been dropped entirely along with its contained pieces of information. We can remove multiple columns using this syntax too.

ALTER TABLE table_name
DROP COLUMN column_name_1,
DROP COLUMN column_name_2,
...;
Tags