MySQL数据库-2026-4-1-上午上两节课-group by语句,内部链接

MySQL数据库-2026-4-1-上午上两节课-group by语句,内部链接 一.group by 语句#练习group by 语句 分组 如果涉及到筛选则使用having#分组语句的列信息一定要在分组的声名列表中select courseNo’课程编号’from score group by courseNo;#分组语句与聚合函数联合使用select courseNo’课程编号’,sum(result)‘课程总分’,avg(result)‘平均分’,max(result)‘最高分’,min(result)‘最低分’,count(result)‘参考人’from score group by courseNo order by count(result) desc;二.内部链接select * from score inner join student on student.studentNoscore.studentNo;select * from student left join score on student.studentNoscore.studentNo;select COUNT() from score;select COUNT() from student;#笛卡尔积nm2622572select#查询score.studentNo’学生编号’,student.studentName’学生名称’,SUM(result)‘期中考试总成绩’,avg(result)‘平均分’#连表以及去掉笛卡尔积from score inner join student on student.studentNoscore.studentNogroup by score.studentNo,student.studentName#继续使用排序oder by SUM(result) desc;select studentNo from score group by studentNo;