oracle
表示按id降序后取前6行
select * from(select * from test order by id desc) where rownum<= 6 ;
表示取前6行后再按id降序
select * from test where rownum<= 6 order by id desc ;
mysql
表示先升序再取前6行
select * from test order by id asc limit 6;
表示先升序, 从第5条开始取10条
select * from test order by id asc limit 5,10 ;