Reputation: 1096
`gender` enum('female','male','rather not say','alien') NOT NULL default 'rather not say',
Is this the correct way to use enum?
Upvotes: 25
Views: 10409
Reputation:
Yes it is. More info here http://dev.mysql.com/doc/refman/5.0/en/enum.html
Your use of ENUM takes less storage space and is much faster than if you stored the actual strings since MySQL internally represents each choice as a number. I.e. female = 0, male = 1, etc.
Upvotes: 28