吾生有涯,而知无涯,适当止学.循序渐进,步步提升 Talk is cheap, show me the code.
分类: Mysql/postgreSQL
2012-07-10 18:04:11
YEAR类型,可以定义为YEAR(4) or YEAR(2),但是表现方式
不一致,如下:
As a 4-digit string in the range '1901' to '2155'.
As a 4-digit number in the range 1901 to 2155.
As a 1- or 2-digit string in the range '0' to '99'. Values in the ranges '0' to '69' and '70' to '99' are converted to YEAR values in the ranges 2000 to 2069 and 1970 to 1999.
As a 1- or 2-digit number in the range 1 to 99. Values in the ranges 1 to 69 and 70 to 99 are converted to YEAR values in the ranges 2001 to 2069 and 1970 to 1999.
备注小记:
timestamp除了上面的时区问题,还有一个有趣的现象。
mysql>
从上述例子来看,如果不设置default,它默认给你current_timestamp另外赋予零值表示,而且timestamp不能同时CURRENT_TIMESTAMP或者now()存在,否则会报表定义错误(Incorrect table definition)