当前位置:网站首页>Detailed sorting of Oracle and MySQL pages
Detailed sorting of Oracle and MySQL pages
2022-06-22 08:17:00 【Hanxiaozhi】
Database Paging SQL sentence :
I don't say much nonsense , Go straight to the code ,Orcle and Mysql Paging formula for
①:MySQL Pagination ,select * from emp limit m,n;(m Indicates the starting index of the query data ,n Indicated from m+1 strip Inquire about n strip )
1. Paging requirements each page 3 strip , Query the first 2 page
page = 2;
pageSize =3;
2. The formula
Starting index
startIndex = (page-1)*pageSize
Maximum number per page
maxCount = pageSize;
3.sql example
select * from emp limit satrtIndex,maxCount;
②:Orcle Pagination
1. Paging requirements each page 3 strip , Query the first 2 page
page =2;
pageSize =3;
2. The formula
Start line number
startRownum = (page-1)*pageSize+1;
End line number
endRownum = page*pageSize;
3.sql example
select * from (select rownum r,t.* from emp t where rownum <=6) where r>=4;
select * from (select rownum r,t.* from emp t where rownum <=endRownum ) where r>=startRownum ;
③: Summarize paging again :
1.MySQL: use limit keyword
2.Orcle: use rownum Line number to page
边栏推荐
- 0 basic self-study STM32 (wildfire) -- what is a register?
- Mt4/mql4 getting started to proficient in foreign exchange EA automatic trading tutorial - identify the emergence of the new K line
- 【Oracle 数据库】奶妈式教程 day14 转换函数
- SVN 提交子文件夹问题
- Example of QT qtableview
- Optimization of MySQL paging scheme by database and table
- 将数组中的数逆序存放
- Bee framework, an ORM framework that can be learned in ten minutes --bee
- Mt4/mql4 getting started to be proficient in EA tutorial lesson 7 - common functions of MQL language (VII) - index value taking function
- Chapter VIII web project testing (the end of this chapter)
猜你喜欢

The solution to the problem of the first screen picture loading flicker

QT error prompt 1:invalid use of incomplete type '***‘

Three characteristics of concurrency 2-orderliness

MySQL transactions

swagger中的枚举、自定义类型和swaggerignore

steam教育文化传承的必要性

0 basic self-study STM32 (wildfire) -- what is a register?

开展有效的创客教育课程与活动

多点闹钟实例

Easyui数据表实现增删改
随机推荐
【Oracle 数据库】奶妈式教程day15 DDL、DML、索引、视图、序列、死锁这一篇就够了
Mt4/mql4 getting started to be proficient in EA tutorial lesson 7 - common functions of MQL language (VII) - index value taking function
第八章 Web项目测试(此章完结)
Questions 101 to 200 of the national information security grade examination nisp level 1 question bank (1)
How to handle root password forgetting in MySQL
DTD约束
The solution to the problem of the first screen picture loading flicker
Postgresql源码(56)可扩展类型分析ExpandedObject/ExpandedRecord
Type of sub database and sub table
swagger中的枚举、自定义类型和swaggerignore
dom4j+xpath解析xml文件
LNMP environment setup
复杂科学在创客教学研究中的应用
[Oracle database] mammy tutorial day14 conversion function
How to select the appropriate partition key, routing rule and partition number
golang中使用swagger遇到的一些问题
C language implements inserting and reading pictures into MySQL
Example of using listagg in Oracle 11g (splicing the values of a field into a line, separated by commas)
QT combox的使用示例
Record once · ulimit: open files: cannot modify limit: operation not allowed