Oracle:
select * from (
select rownum as num,a.* from (
select * from zjfx_book_mark order by to_number(id) ) a
where rownum <= 20)
where num > 10
MySQL:
select d.* from (
select cast(@ROW :=@ROW + 1 as SIGNED) AS NUM,c.* from (
select b.* from zjfx_book_mark b order by cast(id as SIGNED)) c
left join (SELECT @ROW := 0) r ON 1 = 1) d limit 10,10
本文对比了Oracle和MySQL数据库中两种不同查询策略,通过示例展示如何利用rownum和ROW_NUMBER优化SQL,探讨了在实际项目中的应用和性能差异。
2161

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



