nebeker

@nebeker@programming.dev
0 Post – 2 Comments
Joined 6 months ago

To answer the part of your question I think is most fun, there is a standard for SQL. There are many dialects of SQL, but you’ll often hear of “ANSI SQL.” The latest version is SQL:2023.

Looking at the MySQL manual entry for the YEAR type, I think we can conclude two things:

  1. The developers consider the possibility of deprecating and removing support for time data type features;

  2. They use “reasonable defaults” for conversions of 2 digit years, based on the current year.

The good news is it sounds like this issue is being taken into account. I’m sure the conversion window will be adjusted in future version and the data type may be changed or deprecated altogether. I wouldn’t be surprised if they added a YEAR2 though. T-SQL has a datetime2, after all.

2 more...

I’m inferring based on the deprecation of YEAR(4) and the conversion time window that obviously needs to be updated at some point.