How can we allow MySQL to store invalid dates?

MySQLMySQLi Database

After enabling the SQL MODE to ALLOW_INVALID_DATES, MySQL will also be able to store invalid dates in the table. The example is given below to understand it −

mysql> Insert into order1234(ProductName, Quantity, Orderdate) values('B',500,'2015-11-31');
Query OK, 1 row affected (0.06 sec)

mysql> Select * from order1234;
+-------------+----------+--------------+
| ProductName | Quantity | OrderDate    |
+-------------+----------+--------------+
| A           | 500      | 0000-00-00   |
| B           | 500      | 2015-11-31   |
+-------------+----------+--------------+
2 rows in set (0.00 sec)

We can see MySQL also inserts the invalid date in a table.

raja
Published on 19-Feb-2018 06:28:48
Advertisements