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/