如何在 MySQL 中儲存像“0000-00-00”這樣的日期
為了在一個 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)
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
JavaScript
PHP