
- 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 I remove a value from an enum in MySQL?
Use ALTER command to remove a value from an enum in MySQL. Let us first create a table −
mysql> create table DemoTable ( `Rank` ENUM('LOW','MEDIUM','HIGH') ); Query OK, 0 rows affected (0.52 sec)
Let us check the description of table.
mysql> DESC DemoTable;
This will produce the following output −
+-------+-----------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-----------------------------+------+-----+---------+-------+ | Rank | enum('LOW','MEDIUM','HIGH') | YES | | NULL | | +-------+-----------------------------+------+-----+---------+-------+ 1 row in set (0.00 sec)
Following is the query to remove a value from an enum in MySQL.
mysql> alter table DemoTable change `Rank` `Rank` ENUM('LOW','HIGH'); Query OK, 0 rows affected (1.19 sec) Records: 0 Duplicates: 0 Warnings: 0
Now let us check the description of table once again −
mysql> DESC DemoTable;
This will produce the following output −
+-------+--------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------------+------+-----+---------+-------+ | Rank | enum('LOW','HIGH') | YES | | NULL | | +-------+--------------------+------+-----+---------+-------+ 1 row in set (0.00 sec)
- Related Articles
- How can I insert default value in MySQL ENUM data type?
- How can I get enum possible values in a MySQL database?
- How can I remove a specific item from an array in JavaScript
- How can I remove a specific item from an array JavaScript?
- How can I get enum possible values in a MySQL database using PHP?
- How can I remove every column in a table in MySQL?
- How to remove partial text from value in MySQL?
- How can we remove a column from MySQL table?
- How do I remove ON UPDATE CURRENT_TIMESTAMP from an existing column in MySQL?
- How can I drop an existing column from a MySQL table?
- What MySQL returns if I insert invalid value into ENUM?
- How do I remove a uniqueness constraint from a MySQL table?
- How can I remove dandruff from my hair?
- How can I change the value of an instance of a row in MySQL table?
- How can we remove NOT NULL constraint from a column of an existing MySQL table?

Advertisements