I will be storing a year in a MySQL table: Is it better to store this as a smallint or varchar? I figure that since it’s not a full date, that the date format shouldn’t be an answer but I’ll include that as well.
Smallint? varchar(4)? date? something else?
Examples:
-
2008
-
1992
-
2053
I would use the YEAR(4) column type… but only if the years expected are within the range 1901 and 2155… otherwise, see Gambrinus’s answer.