怎么在mysql中查询 平均分比 刘晨高的学生信息 学生表(学号,姓名,性别,年龄,班级) 课程 在SQL server中查询每个学生的班级、学号、姓名、平均...

\u5b66\u751f\u6570\u636e\u5e93\u5305\u542b\u5982\u4e0b\u4e09\u4e2a\u8868:student(\u5b66\u53f7,\u59d3\u540d,\u6027\u522b,\u5e74\u9f84,\u6240\u5728\u7cfb)

1select student.\u59d3\u540d,sc.\u6210\u7ee9from student,course,sc where student.\u5b66\u53f7=sc.\u5b66\u53f7 and course.\u8bfe\u53f7=sc.\u8bfe\u53f7 and student.\u6027\u522b='\u5973' 2select student.\u59d3\u540d,sc.\u6210\u7ee9from student,course,sc where student.\u5b66\u53f7=sc.\u5b66\u53f7 and course.\u8bfe\u53f7=sc.\u8bfe\u53f7 and student.\u5e74\u9f84=22 and course.\u8bfe\u7a0b\u540d='\u82f1\u8bed' 3select \u59d3\u540d,year(getdate())-\u5e74\u9f84 as \u51fa\u751f\u5e74\u4efd from student where \u6027\u522b='\u7537'

select a.\u5b66\u53f7, a.\u59d3\u540d,a.\u73ed\u7ea7\u7f16\u53f7, avg(b.\u5206\u6570) \u5e73\u5747\u5206

from \u5b66\u751f\u4fe1\u606f\u8868 a, \u6559\u5b66\u6210\u7ee9\u8868 b
where a.\u5b66\u53f7=b.\u5b66\u53f7
group by a.\u5b66\u53f7, a.\u59d3\u540d,a.\u73ed\u7ea7\u7f16\u53f7
order by \u5e73\u5747\u5206 desc, \u73ed\u7ea7\u7f16\u53f7

select student_num,student_name,sex,age,student_class
from
student_message
group by student_num
having avg(student_grade)>(select avg(student_grade) where student_name='刘晨' limit 0,1);

把表的结构贴出来--

扩展阅读:mysql查询男女平均年龄 ... mysql模糊查询的关键字 ... mysql一对多表查询 ... mysql 查询两个字的姓名 ... mysql查询学生平均成绩 ... 一键查询 ... mysql 查询时排除字段 ... 查询每个系的平均年龄 ... mysql查询平均成绩语句 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网