分页和排序
--排序 升序 ASC 降序 DESC
-- 语法 ORDER BY
SELECT s.`studentno`,studentname,`subjectno`,`studentresult`
FROM student AS s
LEFT JOIN result AS r
ON s.studentno = r.studentno
ORDER BY studentresult DESC
SELECT s.`studentno`,studentname,`subjectno`,`studentresult`
FROM student AS s
LEFT JOIN result AS r
ON s.studentno = r.studentno
ORDER BY studentresult ASC
分页
缓解数据库的压力,也有使用瀑布流的,不使用分页,百度的图片就是这个逻辑
每页只显示5条数据
语法 limit 查询起始下标 页面大小pagesize
SELECT s.`studentno`,studentname,`subjectno`,`studentresult`
FROM student AS s
LEFT JOIN result AS r
ON s.studentno = r.studentno
ORDER BY studentresult ASC
LIMIT 0,5