

- 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
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 Questions & Answers
- what are the different attributes of MySQL ENUM data type?
- What is a Type-safe Enum in Java?
- The equals and == operator for Enum data type in Java
- How can I insert default value in MySQL ENUM data type?
- What should one use CHAR data type or VARCHAR data type in MySQL?
- 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?
- What is BLOB data type in MySQL?
- What is TEXT data type in MySQL?
- What is the data type for unix_timestamp in MySQL?
- MySQL data types int versus enum?
- What are primitive data type in C++?
- What data type to use for hashed password field in MySQL?
- What is the best data type to use for currency in C#?
- What is the difference between MySQL DATETIME and TIMESTAMP data type?
Advertisements