題目:26:查詢平均成績大於等於 85 的所有學生的學號、姓名和平均成績
分析:這個應該是根據student 進行分組 group by 再根據 having >= 85 進行過濾,然后在關聯student 信息表,拿到學生的基本信息
SELECT student.id, student.stdentname,AVG(student_score.score) AS a FROM student_score, student
WHERE student.id = student_score.studentid
GROUP BY student_score.studentid HAVING a>=85
題目27:查詢課程名稱為「數學」,且分數低於 60 的學生姓名和分數
分析: 這個應該是多表查詢 student , student_course, student_score 三個表查詢
SELECT student.id,student_course.coursename, student.stdentname,student_score.score FROM student_course, student_score,student
WHERE student_course.coursename = "數學" AND student_course.id = student_score.courseid AND student_score.score<60
AND student_score.studentid = student.id