
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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.
- Related Articles
- How can we remove NOT NULL constraint from a column of an existing MySQL table?
- How can we remove PRIMARY KEY constraint from a column of an existing MySQL table?
- How can we remove FOREIGN KEY constraint from a column of an existing MySQL table?
- Can we remove a primary key from MySQL table?
- Can we add a column to a table from another table in MySQL?
- How can I remove every column in a table in MySQL?
- How can we extract a substring from the value of a column in MySQL table?
- How can we modify column/s of MySQL table?
- How can we create a new MySQL table by selecting specific column/s from another existing table?
- How can we put comments in a column of existing MySQL table?
- How can we use MySQL EXPORT_SET() function with column of a table?
- How can we delete multiple rows from a MySQL table?
- How can we delete all rows from a MySQL table?
- How can we drop UNIQUE constraint from a MySQL table?
- How can we update MySQL table after removing a particular string from the values of column?

Advertisements