Site icon TestingDocs.com

MySQL ENUM Datatype

Overview

ENUM datatype is an enumerated data type. An ENUM data type definition entails a list of strings. A value for that particular ENUM data type must be one of the values specified in that list.

Syntax

The general syntax for assigning a column to the ENUM data type is as follows:

ENUM(‘Value1’, ‘Value2′,’Value3’,……)

An ENUM column can have a maximum of 65,535 distinct values. ENUM values are represented internally as integers.

Example

String ENUM example from the MySQL world database:

Table: Country

Column: Continent

Field: Continent
Type: enum(‘Asia’,’Europe’,’North America’,’Africa’,’Oceania’,’Antarctica’,’South America’)

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Exit mobile version