Computer Science, asked by khyatinaik6046, 10 months ago

How MySQL handles the empty and null values for enumerations?

Answers

Answered by brainlyboss0
7

MySQL accepts empty values for enumeration only if SQL mode is not set as TRADITIONAL, STRICT_TRANS_TABLES or STRICT_ALL_TABLES. Otherwise, MySQL would not accept empty values and throws an error. As we know that each enumeration value is having an index value, the empty value would have 0 index value.

Example

mysql> SET SQL_MODE ='Traditional';

Query OK, 0 rows affected (0.00 sec)

mysql> Insert into result(id, name,grade) values(100, 'Raman', '');

ERROR 1265 (01000): Data truncateo.

I hope this will help you.

Similar questions