Re: ENUM() vs TINYINT
On 9/21/2015 9:03 AM, Richard Reina wrote:
I have a column name quarter which I need to have 5 possible inputs; 1, 2,
3, 4, or OT. Because of the OT possibility I am leaning towards ENUM.
Hence, I am also thus considering ENUM('first', 'second', 'third',
'fourth', 'overtime') as the input will primarily be used in written
descriptions. Is this a wise or unwise way to design a table column?
Depending on the specific sport (and level of competition), there may be
more than one OT period. Do you really want to aggregate all of the OT
stats into just one bucket?
It makes better sense to me to use a TINYINT for storage then for any
values >=5 convert to "OT", "OT2", ... unless it makes no difference
for your purposes which period of extra play you might be in.
This would also allow you to easily query your stats for any rows where
`quarter`>4 to see which games, if any, experienced any OT play at all.
You could do the same with ENUMS but then you would need a longer list
of ENUMS (OT, OT2, OT3, ... ) to cover all the possibilities.
MySQL Senior Principal Technical Support Engineer
Oracle USA, Inc. - Integrated Cloud Applications & Platform Services
Office: Blountville, TN
Become certified in MySQL! Visit https://www.mysql.com/certification/
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql