Home  >  Article  >  Database  >  How can we make MySQL store invalid dates?

How can we make MySQL store invalid dates?

WBOY
WBOYforward
2023-09-09 15:13:021027browse

How can we make MySQL store invalid dates?

After enabling SQL mode to ALLOW_INVALID_DATES, MySQL will also be able to store invalid dates in the table. 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 that MySQL is also inserting invalid date in the table.

The above is the detailed content of How can we make MySQL store invalid dates?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete