MySQL and Oracle paging query paging query




The MySQL: the Select ... from ... WHERE ... ... by Order Start limit, pageNum Example: such as from 10 taken 20 is data SELECT * from Table limit 10 , 20 is String SQL = " SELECT * WHERE limit from AddressBook " + (currentPage- . 1 ) pageRecord * + " , " + pageRecord + " " ; // SELECT * from the condition table [M] limit, N; // M is started from the first few records, such as page display bar record, it must start from the second page article records // N number of data page reads the Oracle: the SELECT * from( SELECT rownum, name from Table WHERE rownum <= endIndex) WHERE rownum> startIndex Example: e.g. Table Sys_option (primary key sys_id) from the 10 records is retrieved 20 is record, the statement is as follows: SELECT * FROM (SELECT ROWNUM R , . Sys_option the from T1 * T1 WHERE rownum <= 30 ) the Where t2.R T2> 10 ; String sqls = " . SELECT * from (SELECT rownum RN, from AddressBook T * T WHERE rownum <= " + * The currentPage pageRecord + " ) WHERE rownum> " + (The currentPage - . 1 ) * pageRecord;

Note :( which pagination is not the same, is not the same parameter limit)

  1, MySQL tab implementations limit () is a parameter is from the first few records, the second number of records per page is

  2, Oracle paging query: rownum> start record, rownum <record end position 

     

Guess you like

Origin www.cnblogs.com/karrya/p/11599758.html