Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL enum vs. set

Tags:

database

mysql

For MySQL Data type of "enum" and "set" what are the differences and advantages and disadvantages of using one versus the other?

Example data type:

  • enum('A', 'B', 'C')
  • set('A', 'B', 'C')

The only difference that I am aware of is that ENUM only allows one value to be selected versus SET allows multiple values to be selected.

like image 307
tfont Avatar asked Feb 10 '13 11:02

tfont


1 Answers

analogy:
ENUM = radio fields (only accepted values are those listed, may only choose one)
SET = checkbox fields (only accepted values are those listed, may choose multiple)

like image 157
Brad Kent Avatar answered Oct 11 '22 15:10

Brad Kent