
Let us insert data into the table: – insert into student_sports_data values(1,'Sai','Y','Y','N','Y','Y','N','Y') Swimming enum('Y','N')/*- ENUM Datatypecolumn-*/ Table creation: – create table Student_Sports_data Let us consider a simple example of the same: – If we check the list of all users, the columns specified in the user table are mostly defined as an ENUM data type. Let us see where the ENUM is usually defined in MySQL. It has readable queries, which makes it a readable query and output.

), which represent the string values because of which it has compact data storage.

In addition, you would not be worried about those values matching up exactly with the base table definition of the type.

Just by adding new entries into a table with the types needed, keys can be passed around to other tables without worrying about the underlying value being properly represented in the foreign tables. Using foreign keys makes a great deal of sense when you know that the types you are establishing can be extended, reduced, or altered. While there are bait-and-switch tricks you can perform to extend a range for an ENUM, those same tricks become very cumbersome (maybe even impossible) if you want to do other things such as reducing or altering an ENUM range. Once those values are put in place, it can be rather challenging to perform any kind of simple maintenance should you want to redefine the ENUM range. When using ENUM to have a range of values, you have to properly plan what values you will use.
