mysql练习题练习
1、数据库是按照原文制作的,表格结构一样具体存储的数据有些差异 原文地址: MySQL练习题 原答案地址: MySQL练习题参考答案 2、查询“生物”课程比“物理”课程成绩高的所有学生的学号; select wl.sid from (select sc.student_id as sid,sc.number as grade from score sc,course c where c.cid=sc.course_id and c.cname='物理') as wl,(select sc.student_id as sid,sc.number as grade from score sc,course c where c.cid=sc.course_id and c.cname='生物') as sw where wl.sid=sw.sid and sw.grade>wl.grade; 3、查询平均成绩大于60分的同学的学号和平均成绩; select student_id,avg(number) as avg from score group by student_id having avg(number)>60; 4、查询所有同学的学号、姓名、选课数、总成绩; select s.sid,s.sname,w.total,w.sum from student s,(select