This article mainly describes the actual operation procedures of SQL Server, ORACLE, and MySQL efficient paging query, as well as the statements and codes we need to use in actual operations, the following is a description of the specific solution. I hope it will help you in your future study.
If the query results need to be paged, the efficiency below should be relatively high (pink indicates the location 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/** here is the first record on the page **/
- SQLServer: SELECT * FROM (
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 on the SELECT statement LIMIT page-1, page capacity
The above content is an introduction to SQL Server, ORACLE, and MySQL efficient paging query. I hope you will find some gains.
The above content describes the efficient paging query of SQLSERVER, ORACLE, and MySQL. I hope it will help you in this regard.