写出一条Sql语句: 取出表A中第31到第40记录(SQLServer, 以自动增长的ID作为主键, 注意:ID可能不是连续的。)
解1: select top 10 * from A where id not in (select top 30 id from A)
解2: select top 10 * from A where id > (select max(id) from (select top 30 id from A )as A)
这个top 10 *是什么意思?SQLServer我没学过,这道题要是在ORALCE中要咋么写?
解1: select top 10 * from A where id not in (select top 30 id from A)
解2: select top 10 * from A where id > (select max(id) from (select top 30 id from A )as A)
这个top 10 *是什么意思?SQLServer我没学过,这道题要是在ORALCE中要咋么写?
2,select * from A where id>(select max(id) from A where rownum<31 ) and rownum<11
能不能得出第30至40行的数据?
oracle的写法,取出表A中第31到第40记录
select *
from (select rownum rn, t.* from (select A.* from A order by id asc) t)
where rn between 31 and 40
select a.* from (select * from A where order by id asc) a where a.rownum<41 and a.rownum>29