
为了在 MySQL 表的列中存储像“0000-00-00”这样的日期,我们必须将 SQL 模式设置为“allow_invalid_date”。下面的例子将演示它 -
mysql> SET sql_mode = 'allow_invalid_dates';
Query OK, 0 rows affected, 1 warning (0.03 sec)
mysql> Create table test_date(date_order date);
Query OK, 0 rows affected (0.45 sec)
mysql> Insert into test_date(date_order) values('0000-00-00');
Query OK, 1 row affected (0.04 sec)
mysql> Select * from test_date;
+------------+
| date_order |
+------------+
| 0000-00-00 |
+------------+
1 row in set (0.00 sec)以上就是如何在 MySQL 中将“0000-00-00”存储为日期?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号