摘要: 1查询的总人数大于2的性别 查询男女的人数 2晒选出人数大于二的记录 分组之前条件使用where 关键字,分组之后 条件使用 having 关键字 我们先进行分组 select stugender from student by stuGender; 分组之后进行统计 select stugende 阅读全文
posted @ 2018-09-20 22:06 秦明科 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 查询 排序(order by) 语法:order by 字段 asc/desc asc 顺序,正序。数值 :递增,字母:自然顺序(a-z) desc 倒序 反序 数值:递减, 字母:自然反序 默认情况下,安照插入的顺序排序 select * from student; 需求安照 id 顺序排序 反序 阅读全文
posted @ 2018-09-20 21:43 秦明科 阅读(11938) 评论(0) 推荐(2) 编辑
摘要: 分页查询(limit 起始行,查询几行) 如果 我只想插入 第一第二行的数据 该怎么做那 select from student limit 0,2; 分页查询当前页数的数据 select * from student(当前页-1)*每页多少条记录,每页显示多少条记录 重点 (假如每页显示2条) 需 阅读全文
posted @ 2018-09-20 21:33 秦明科 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 聚合查询 常用的聚合查询有:sum() avg() max() min() count() 需求:查询学生的math的总成绩(sun()求和函数) select sum (math)as ‘math的总成绩’from result; 查询 math 的平均分 select avg(math) as 阅读全文
posted @ 2018-09-20 21:19 秦明科 阅读(1999) 评论(0) 推荐(0) 编辑