The following articles mainly describe the actual operation steps of SQL Server, ORACLE, and MySQL efficient paging query. if the query results require paging, the related efficiency is generally described, the following efficiency should be relatively high (pink indicates the places to be filled according to the actual situation ). III. MySQL Query
The following articles mainly describe the actual operation steps of SQL Server, ORACLE, and MySQL efficient paging query. if the query results require paging, the related efficiency is generally described, the following efficiency should be relatively high (pink indicates the places to be filled according to the actual situation ).
Efficient paging query methods in three types of databases (currently ):
Oracle (large website database platform ):
- SELECT * FROM (
- SELECT MY_TABLE.*,ROWNUM AS MY_ROWNUM FROM (
Write the actual SQL statement to be queried in parentheses
- ) AS MYTABLE WHERE ROWNUM <=200
This is the last record on the page.
- \) WHERE MY_ROWNUM>=10
This is the first record on the page.
- SQLServer: SELECT * FROM (
SQLSERVER, ORACLE, and MySQL efficient paging query: select top page capacity * FROM (
Select top Page capacity * Current page number * FROM
Table WHERE condition order by field A ASC
- ) AS TEMPTABLE1 order by field A DESC
- ) AS TEMPTABLE2 order by field A ASC
MySQL (best combination with PHP): The first record-1 on the SELECT statement LIMIT page, page capacity.
The above content is an introduction to SQL Server, ORACLE, and MySQL efficient paging query. I hope you will find some gains.