为了将“ 0000-00-00”之类的日期存储在MySQL表的一列中,我们必须将SQL模式设置为“ allow_invalid_date”。以下示例将演示它-
mysql> SET sql_mode = 'allow_invalid_dates'; mysql> Create table test_date(date_order date); mysql> Insert into test_date(date_order) values('0000-00-00'); mysql> Select * from test_date; +------------+ | date_order | +------------+ | 0000-00-00 | +------------+ 1 row in set (0.00 sec)