mysql - MySql 中的间隔数据类型

标签 mysql types

MySql 是否像 PostgreSQL(或 .net 中的 TimeSpan)一样具有 Interval 数据类型?

最佳答案

不,MySQL 中没有时间间隔数据类型。有一个feature request一方面,但显然它没有引起太多关注。

不过,时间类型可以用于这样的目的,正如 documentation 所建议的那样

MySQL retrieves and displays TIME values in 'HH:MM:SS' format (or 'HHH:MM:SS' format for large hours values). TIME values may range from '-838:59:59' to '838:59:59'. The hours part may be so large because the TIME type can be used not only to represent a time of day (which must be less than 24 hours), but also elapsed time or a time interval between two events (which may be much greater than 24 hours, or even negative).

关于mysql - MySql 中的间隔数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4037777/

相关文章:

haskell - 什么是 '[] and ' : in Haskell?

java - JPA - 我的命名查询不起作用

php - 检查哪个用户点击了哪个链接

php - 需要 mySQL/php 建议如何构建特定的 mysql 数据库

php - 验证后为什么我的选择标签数据被清除

c++ - 在 C++ 中存储类型

types - 标准 ML 二叉树类型

java - 在 Java 中寻找 "chained map"实现

mysql - 在 Mysql 中排序然后分组

xcode - 没有将AbsoluteTime类型导入Swift