MySql中的间隔数据类型 [英] Interval datatype in MySql

查看:260
本文介绍了MySql中的间隔数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Does MySql has the Interval datatype as PostgreSQL (or like TimeSpan in .net) does?

推荐答案

不,MySQL中没有时间间隔数据类型.虽然有一个功能请求,但是显然它并没有太多注意.

Nope, there is no time interval data type in MySQL. There is a feature request for one though, but apparently it hasn't gotten much attention.

时间类型可以用于此目的,如

The time type can be used for such a purpose though, as suggested by the documentation

MySQL检索并显示TIME "HH:MM:SS"格式的值(或 长时间使用"HHH:MM:SS"格式 值). TIME值的范围可能是 '-838:59:59'至'838:59:59'. 时间 部分可能太大,因为时间 类型不仅可以用来表示 一天中的某个时间(必须小于 24小时),但也要经过一段时间或 两个事件之间的时间间隔 (可能大于24 小时,甚至是负数).

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中的间隔数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆