间隔操作

如果用间隔除以间隔,您可以获得一个 FLOAT

=> SELECT INTERVAL '28 days 3 hours' HOUR(4) / INTERVAL '27 days 3 hours' HOUR(4);
 ?column?
------------
 1.036866359447

FLOAT 除以 INTERVAL 会返回 INTERVAL

=> SELECT INTERVAL '3' MINUTE / 1.5;
 ?column?
------------
 2 mins

INTERVAL MODULO (余数)INTERVAL 返回 INTERVAL

=> SELECT INTERVAL '28 days 3 hours' HOUR % INTERVAL '27 days 3 hours' HOUR;
  ?column?
------------
 24 hours

如果添加 INTERVALTIME,则结果为 TIME,取模 24 小时:

=> SELECT INTERVAL '1' HOUR + TIME '1:30';
 ?column?
------------
 02:30:00