顾名思义,启用ALLOW_INVALID_DATES SQL模式将使我们能够在表中存储无效日期。下面给出的例子来理解它-
mysql> SET sql_mode = ALLOW_INVALID_DATES; mysql> Insert Into detail_bday(Name, Birth_Date) values('Sonia','1993-11-31'); mysql> Insert Into detail_bday(Name, Birth_Date) values('Ram','0000-00-00'); mysql> Select * from detail_bday; +----+---------+------------+ | Sr | Name | Birth_Date | +----+---------+------------+ | 1 | Saurabh | 1990-05-12 | | 2 | Raman | 1993-06-11 | | 3 | Gaurav | 1984-01-17 | | 4 | Rahul | 1993-06-11 | | 5 | Sonia | 1993-11-31 | | 6 | Ram | 0000-00-00 | +----+---------+------------+ 6 rows in set (0.00 sec)
上面的结果集显示,在启用ALOOW_INVALID_DATES SQL模式后,MySQL允许我们存储无效的日期,例如“ 1993-11-31”和“ 0000-00-00”。