"root@localhost 03:22:50 [test]>create table test_null ( id int,date timestamp);
Query OK, 0 rows affected (0.04 sec)
"root@localhost 03:22:57 [test]>insert into test_null values(1,null);
Query OK, 1 row affected (0.00 sec)
"root@localhost 03:23:02 [test]>select *from test_null;
+------+---------------------+
| id | date |
+------+---------------------+
| 1 | 2017-07-04 03:23:02 |
+------+---------------------+
1 row in set (0.00 sec)
"root@localhost 03:23:09 [test]>insert test_null values(1,'');
ERROR 1292 (22007): Incorrect datetime value: '' for column 'date' at row 1
"root@localhost 03:24:22 [test]>insert into test_null(id) values(null);
Query OK, 1 row affected (0.00 sec)
"root@localhost 03:24:59 [test]>insert into test_null(id) values('');
ERROR 1366 (HY000): Incorrect integer value: '' for column 'id' at row 1
"root@localhost 03:25:21 [test]>select * from test_null;
+------+---------------------+
| id | date |
+------+---------------------+
| 1 | 2017-07-04 03:23:02 |
| NULL | 2017-07-04 03:24:59 |
+------+---------------------+
2 rows in set (0.00 sec)
1、对于timestampe 和 int 类型,不能设置值为空串
2、当timestampe 类型设置为 null时,会用当前的时间替代
3、