The Oracle query you mentioned is still very common. It is often used during project development. It is impossible to load large volumes of data to the memory at a time. This will use paging, paging uses the range I used. net Microsoft followers (oh, don't disagree! Java and. net in this industry, the battle of the tongue has not been closed), also use ORACLE you said this range query in SQL Server may be better achieved, because it has a top keyword. this is not to mention, mainly oracle. oracle has a rownum keyword. Its function is equivalent to SQL Server's top. rownum returns the internal row number of the table and queries the number of records, its row number will increase from 1 to the last record, and this increment is real-time. therefore, we cannot use the conventional idea to query.
For example, select * From tablename where rownum> = 1000 and rownum <= 10000 because the record has not been generated, the condition you give does not work at all, so it is null. but there is a solution. We may make a subquery to convert rownum into usable data.
Select rownum field_byname, table_byname. * From tablename table_byname and embed it into the following brackets
Select * from (select rownum field_byname, table_byname. * From tablename table_byname) A where a. field_byname> = 1000 and A. field_byname <= 10000 this method is easy to understand,
But the efficiency is not high. It queries all the data and then queries the rows between 1000 and 10000 from all the data. According to the Cartesian Product Principle, the redundancy is quite large. there is also a way to improve the preceding SQL, which is much more efficient.
Select * from (select rownum field_byname, table_byname. * From tablename table_byname
Where rownum <= 10000) A where a. field_byname >=1000