SQL Performance Tuning: Dates in SQL
During research for our book SQL Performance Tuning (Addison Wesley Professional, 2002), we found that using dates brings up some portability problems, some undocumented features, and some areas that cry out for more explanation. This article shows how the DATE data type works with eight SQL database-management systems: IBM DB2, Informix, Ingres, InterBase, Microsoft SQL Server, MySQL, Oracle, and Sybase (we'll call these "the Big Eight DBMSs").
Our concern is what you can do with dates, so we'll leave aside information on how to format a date and other locale-specific trivia. We'll use extended dates such as January 4 1970 throughout, except when we're showing a value in ANSI/ISO SQL Standard form (such as 1970-01-04).