oracle提取表一个 表3-5行,用两种sql语句实现,其中一种用minus

是这样的,想请讲解下,oracle提取表一个 表3-5行,用两种sql语句实现,其中一种用minus
最新回答
到此为止

2024-10-17 08:14:21

满意请采纳

方法一:

select * from tabletest1 a
where rownum <= 5
minus
select * from tabletest1 b
where rownum <= 2

方法二:
select * from
(
select a.*, rownum as rn from tabletest1 a
where rownum <= 5
) b
where b.rn > 2;

方法三:
select * from
(
select a.*, rownum as rn from tabletest1 a
) b
where b.rn between 3 and 5;