MySQLç®åä¸æ¯æåçDefault 为å½æ°çå½¢å¼,å¦è¾¾å°
ä½ æåçé»è®¤å¼ä¸ºå½åæ´æ°æ¥æä¸æ¶é´çåè½,ä½ å¯ä»¥ä½¿ç¨TIMESTAMPåç±»åä¸é¢å°±
详ç»è¯´æTIMESTAMPåç±»å
| TIMESTAMP(14) | YYYYMMDDHHMMSS |ã
| TIMESTAMP(12) | YYMMDDHHMMSSã |
| TIMESTAMP(10) | YYMMDDHHMMãã |
| TIMESTAMP(8)ã| YYYYMMDDããã |
| TIMESTAMP(6)ã| YYMMDDãããã |
| TIMESTAMP(4)ã| YYMMããããã |
| TIMESTAMP(2)ã| YYãããããã |
çä½ éè¦åªç§æ¶é´çæ ¼å¼ï¼ å¨æå
¥æ°æ®çæ¶åï¼ç»æ¶é´çå段设置æNULLå°±ä¼èªå¨åæå½åæ¶é´ãç»ä½ 举个ä¾åï¼
CREATE TABLE test (
'id' INT (3) UNSIGNED AUTO_INCREMENT,
'date1' TIMESTAMP (8),
PRIMARY KEY('id')
);
INSERT INTO test (id, date1) VALUES (1, NULL);
id date
1 20160429
温馨提示:答案为网友推荐,仅供参考