- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is MySQL ENUM data type? What are the advantages to use ENUM data type?
The ENUM data type, different from standard data types, is an enumerated list of 1 to 65,535 strings indicating the allowed values for the field. When defining an ENUM, you are creating a list of items from which the value must be selected (or it can be NULL).
For example, if you wanted your field to contain "A" or "B" or "C", you would define your ENUM as ENUM ('A', 'B', 'C') and only those values (or NULL) could ever populate that field.
Potentially followings are some advantages of ENUM data types −
- Compact data storage can be observed in the situations where a column has a limited set of possible values.
- The specified strings as input values are mechanically encoded as numbers.
- The numbers are translated back to the corresponding strings in query result
- By using ENUMs, we have readable queries and output.
- Related Articles
- what are the different attributes of MySQL ENUM data type?
- How can I insert default value in MySQL ENUM data type?
- Does SQL Server have an equivalent to MySQL's ENUM data type?
- Add a new value to a column of data type enum in MySQL?
- The equals and == operator for Enum data type in Java
- What is a Type-safe Enum in Java?
- What should one use CHAR data type or VARCHAR data type in MySQL?
- MySQL data types int versus enum?
- What is BLOB data type in MySQL?
- What is TEXT data type in MySQL?
- What data type to use for hashed password field in MySQL?
- What is the data type for unix_timestamp in MySQL?
- Do MySQL Can Enum type values contain spaces in it?
- Count items in a MySQL table with type ENUM involved?
- What is the best data type to use for currency in C#?

Advertisements