要设置新的延迟时间,请使用INTERVAL并更新带有SETa子句和UPDATE命令的列。让我们首先创建一个表-
mysql> create table DemoTable ( DelayTime time );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable values('11 :30 :10'); mysql> insert into DemoTable values('12 :40 :00'); mysql> insert into DemoTable values('05 :45 :24'); mysql> insert into DemoTable values('09 :00 :10');
使用select语句显示表中的所有记录-
mysql> select *from DemoTable;
这将产生以下输出-
+------------+ | DelayTime | +------------+ | 11 :30 :10 | | 12 :40 :00 | | 05 :45 :24 | | 09 :00 :10 | +------------+ 4 rows in set (0.00 sec)
以下是设置新延迟时间的查询-
mysql> select date_add(DelayTime,interval 10 second) AS `NewDelayTime` from DemoTable;
这将产生以下输出-
+--------------+ | NewDelayTime | +--------------+ | 11 :30 :20 | | 12 :40 :10 | | 05 :45 :34 | | 09 :00 :20 | +--------------+ 4 rows in set (0.00 sec)