sql语句中时间格式为时分秒,怎么查询某天的数据

例如:
图片说明
这是时间字段
我想查询2019年4月24日的数据,应该怎么写?

select * from db where create_time between ''2019-04-24 ” and "2019-04-25"
因为between的边界是包含开始时间,但是不包含结束时间,所以这样的时间区间其实就是“2019-04-24 00:00:00”“2019-04-24 23:59:59”

= date'2019-04-24'

不需要考虑条件字段的时间格式精确到什么粒度。

抱歉,等于不行,弄错了

WHERE created_at > "2019-04-24" AND created_at < "2019-04-25"

用DATEDIFF
SELECT DATEDIFF(day,'2019-04-24','2019-04-24')

DATEDIFF(day,'2019-04-24','2019-04-24') = 0 就是当天了

SELECT * FROM db where create_time >='2019-04-24 00:00:00' and create_time <='2019-04-24 23:59:59';

SELECT * FROM db where create_time >='2019-04-24 00:00:00' and create_time <='2019-04-24 23:59:59';

怎么查询七天前的数据呢?