enum('yes', 'no') vs tinyint -- which one to use?

Yasin Ergul picture Yasin Ergul · Nov 28, 2010 · Viewed 9.5k times · Source

What's the best practice for fields that hold true/false values?

Such columns can be defined as enum('yes','no') or as tinyint(1). Is one better/faster than the other?

Is it better to use enum('1','0') vs. enum('yes','no') (i.e., does it write 'yes' or 'no' as a string to every row so the database storage size gets bigger)?

Answer

Haim Evgi picture Haim Evgi · Nov 28, 2010

avoid enum from this reasons

The bottom line is that ENUM has its place, but should be used sparingly. The model should enforce the constraints, not the database; the model should handle interpreting raw data into useful information for your views, not the database.