Home > Database > Mysql Tutorial > body text

How can we make MySQL store invalid dates?

WBOY
Release: 2023-09-09 15:13:02
forward
1047 people have browsed it

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template