

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- How can I insert default value in MySQL ENUM data type?
- How can I remove a specific item from an array JavaScript?
- 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 get enum possible values in a MySQL database using PHP?
- How can I drop an existing column from a MySQL table?
- How can I remove dandruff from my hair?
- How can I remove every column in a table in MySQL?
- What MySQL returns if I insert invalid value into ENUM?
- How can we remove a column from MySQL table?
- How do I remove a uniqueness constraint from a MySQL table?
- How do I remove ON UPDATE CURRENT_TIMESTAMP from an existing column in MySQL?
- How to remove partial text from value in MySQL?
- How can I change the value of an instance of a row in MySQL table?
- How do I remove a MySQL database?
Advertisements