in reply to working with year in mysql
The MySQL YEAR data type supports the concept of a zero year to represent invalid years. This is distinct from the null value which you can also assign. You may want to use either one of those two values to represent NV (No Vintage). Or as xdg recently showed me, you may not want to.
In any case you are encountering problems because you are truncating the field to 2 digits. As you can see in the MySQL documentation for the YEAR type, the rules for interpreting truncated years are a little complicated. Why don't you just specify the year as a numeric value in the allowed range of the YEAR type, which is 1901 through 2155, and don't truncate things to two digits. The 0 invalid year will not give you trouble then.
|
|---|