1 mysql> create tabletimestamp_eg(2 -> id int not nullauto_increment,3 -> time1 timestamp,4 -> time2 timestamp,5 -> time3 timestamp NOT NULL DEFAULT '2010-01-01 00:00:00',6 -> time4 timestamp,7 -> primary key(id));8 Query OK, 0 rows affected (0.01sec)9
10 mysql> insert into timestamp_eg(id) values(1);11 Query OK, 1 row affected (0.00sec)12
13 mysql> select * fromtimestamp_eg;14 +----+---------------------+---------------------+---------------------+---------------------+
15 | id | time1 | time2 | time3 | time4 |
16 +----+---------------------+---------------------+---------------------+---------------------+
17 | 1 | 2015-12-16 09:23:33 | 0000-00-00 00:00:00 | 2010-01-01 00:00:00 | 0000-00-00 00:00:00 |
18 +----+---------------------+---------------------+---------------------+---------------------+
19 1 row in set (0.01sec)20
21 mysql> update timestamp_eg set id=2 where id=1;22 Query OK, 1 row affected (0.02sec)23 Rows matched: 1 Changed: 1 Warnings: 0
24
25 mysql> select * fromtimestamp_eg;26 +----+---------------------+---------------------+---------------------+---------------------+
27 | id | time1 | time2 | time3 | time4 |
28 +----+---------------------+---------------------+---------------------+---------------------+
29 | 2 | 2015-12-16 09:25:01 | 0000-00-00 00:00:00 | 2010-01-01 00:00:00 | 0000-00-00 00:00:00 |
30 +----+---------------------+---------------------+---------------------+---------------------+
31 1 row in set (0.00sec)32
33 mysql> insert into timestamp_eg(id,time4) values(3,'2011-01-01 00:00:00');34 Query OK, 1 row affected (0.00sec)35
36 mysql> select * fromtimestamp_eg;37 +----+---------------------+---------------------+---------------------+---------------------+
38 | id | time1 | time2 | time3 | time4 |
39 +----+---------------------+---------------------+---------------------+---------------------+
40 | 2 | 2015-12-16 09:25:01 | 0000-00-00 00:00:00 | 2010-01-01 00:00:00 | 0000-00-00 00:00:00 |
41 | 3 | 2015-12-16 09:28:04 | 0000-00-00 00:00:00 | 2010-01-01 00:00:00 | 2011-01-01 00:00:00 |
42 +----+---------------------+---------------------+---------------------+---------------------+
43 2 rows in set (0.00sec)44
45 mysql> update timestamp_eg set id=4 where id=3;46 Query OK, 1 row affected (0.00sec)47 Rows matched: 1 Changed: 1 Warnings: 0
48
49 mysql> select * fromtimestamp_eg;50 +----+---------------------+---------------------+---------------------+---------------------+
51 | id | time1 | time2 | time3 | time4 |
52 +----+---------------------+---------------------+---------------------+---------------------+
53 | 2 | 2015-12-16 09:25:01 | 0000-00-00 00:00:00 | 2010-01-01 00:00:00 | 0000-00-00 00:00:00 |
54 | 4 | 2015-12-16 09:28:24 | 0000-00-00 00:00:00 | 2010-01-01 00:00:00 | 2011-01-01 00:00:00 |
55 +----+---------------------+---------------------+---------------------+---------------------+
56 2 rows in set (0.00sec)57
58 mysql>