select date_trunc('day',sci.xxx_date) FROM _xxx sci
where 1=1 limit 0,1;
select sci.xxx_date FROM _xxx sci
where 1=1 limit 0,1;-- 得到2019-08-05 22:29:17
select date_trunc('year',sci.xxx_date) FROM _xxx sci
where 1=1 limit 0,1;
select date_sub(date_trunc('year',TO_DATE('2019-03-01 03:00:00')),interval 1 day) from dual
select * from student where class_id between 2 and 4;包含2也包含4.
文章详细展示了SQL查询中的日期函数(date_trunc,date_sub)用法,包括按天和年份截断日期,以及如何使用LIMIT获取特定时间范围的数据。还涉及对学生表中class_id范围的查询。
4841

被折叠的 条评论
为什么被折叠?



