PHP & mySQL
I came across a situation where I need to store a value for user selection in one of my columns of a table. Now my options would be to:
I think you should create column with
ENUM('n','y'). Mysql stores this type in optimal way. It also will help you to store only allowed values in the field.
You can also make it more human friendly
ENUM('no','yes') without affect to performance. Because strings
'yes' are stored only once per
ENUM definition. Mysql stores only index of the value per row.
Also note about sorting by
ENUM values are sorted according to the order in which the enumeration members were listed in the column specification. (In other words, ENUM values are sorted according to their index numbers.) For example, 'a' sorts before 'b' for ENUM('a', 'b'), but 'b' sorts before 'a' for ENUM('b', 'a').