我們知道MySQL中TIME字段的范圍是‘-838:59:59’到‘838:59:59’?,F在,如果 TIMEDIFF() 函數的輸出超出此范圍,則 MySQL 將返回 ‘-838:59:59’ 或 ‘838:59:59’,具體取決于參數的值。
示例
mysql> Select TIMEDIFF('2017-09-01 03:05:45','2017-10-22 03:05:45')AS 'Out of Range TIME Difference'; +------------------------------+ | Out of Range TIME Difference | +------------------------------+ | -838:59:59 | +------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> Select TIMEDIFF('2017-10-22 04:05:45','2017-09-01 03:05:45')AS 'Out of Range TIME Difference'; +------------------------------+ | Out of Range TIME Difference | +------------------------------+ | 838:59:59 | +------------------------------+ 1 row in set, 1 warning (0.01 sec)
登錄后復制
上面的查詢表明,如果總差值超出范圍,MySQL 將返回 TIME 字段范圍的最大或最小限制值。
以上就是如果 MySQL TIMEDIFF() 函數的輸出超出 TIME 字段的范圍值會發生什么?的詳細內容,更多請關注www.92cms.cn其它相關文章!