一些有用的sql备忘:
关于日期时间:
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual --当前时间
union all
select to_char(sysdate-1-1/24-1/24/60-1/24/60/60 ,'yyyy-mm-dd hh24:mi:ss') from dual
从多少条到多少条查询 :
①
select * from table where rownum<20
minus
select * from table where rownum<10
②
select * from (select rownum r,a.* from blog a where rownum<=20) where r>=10;
②的效率高于①
本文介绍了两种SQL查询技巧,一种是获取当前时间和指定偏移量之前的时间,另一种是从特定范围内的记录中选择数据。对于时间操作使用TO_CHAR函数结合SYSDATE进行格式化处理,而针对从第N条到第M条记录的查询则提供了两种实现方式。
210

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



