MySQL分页和排序
2022/2/3 19:13:10
本文主要是介绍MySQL分页和排序,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
mysql分页和排序
排序(order by):
- 升序 ASC
- 降序 DESC
SELECT 字段 FROM 表 JOIN 表 ON 条件 WHERE 条件 ORDER BY 字段 DESC/ASC
SELECT student.`StudentNo`,`StudentName`,`SubjectName`,`StudentResult` FROM `student` RIGHT JOIN`result` ON student.`StudentNo`=result.`StudentNo` INNER JOIN `subject` ON result.`SubjectNo`=subject.`SubjectNo` WHERE `SubjectName`='线性代数' ORDER BY `StudentResult` DESC
分页(limit):缓解数据库压力,增加观赏性 瀑布流:无限往下刷
语法:limit 起始位置(第几条数据,从0开始) 页面大小
SELECT student.`StudentNo`,`StudentName`,`SubjectName`,`StudentResult` FROM `student` RIGHT JOIN`result` ON student.`StudentNo`=result.`StudentNo` INNER JOIN `subject` ON result.`SubjectNo`=subject.`SubjectNo` WHERE `SubjectName`='线性代数' ORDER BY `StudentResult` DESC LIMIT 1,1
网页应用:
LIMIT (第N页-1)*pageSize,pageSize
这篇关于MySQL分页和排序的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-21MySQL集群部署资料:新手入门教程
- 2024-09-21MySQL集群资料:初学者入门指南
- 2024-09-21部署MySQL集群资料:新手入门教程
- 2024-09-20MySQL集群部署教程:新手入门指南
- 2024-09-20MySQL集群教程:初学者必备指南
- 2024-09-20部署MySQL集群项目实战:新手入门教程
- 2024-09-20如何部署MySQL集群:简单教程
- 2024-09-20MySQL集群部署:新手入门指南
- 2024-09-20部署MySQL集群学习:入门指南
- 2024-09-20部署MySQL集群入门教程