昆明北京网站建设整站优化和关键词优化的区别
一、现有以下两张表:
第一张表名为cust,其表结构如下:

第二张表名为mark,其表结构如下:

1) [5分]请写出计算 所有学生的英语平均成绩的sq|语句。
2) [5分]现有五 个学生,其学号假定分别为11,22,33,44,55;请用一条SQL语句实现列出这五个学生的数学成绩及其姓名、学生地址、电话号码;
3)[5分]查询所有学生的姓名、计算机成绩,按照计算机成绩从高到低排序;
[5分]查询所有总成绩大于240分的学生学号、姓名、总成绩,按照总成绩从高到低排序;
答案:
1、错:select a.name,avg(b.english) from cust a jion mark b on a.studentno=b.studentno
对:select avg(b.english) from cust a jion mark b on a.studentno=b.studentno
2、select a.name,a.address,a.telno from cust a jion mark b on a.studentno=b.studentno where b.studentno in(11,22,33,44,55)
3、select a.name,b.computer from cust a jion mark b on a.studentno=b.studentno order by computer dasc
4、错:select a.studentno,a.name,b.english+b.math+b.computer from cust a jion mark b on on a.studentno=b.studentno where b.(english+math+computer)>240 order by b.(english+math+computer) dasc
对:SELECTa.Studentno,a. NAME,sum(b.math + b.english + b.computer) zcj
FROMcust a
JOIN mark b ON a.Studentno = b.studentno
GROUP BYa.Studentno,a. NAME
HAVINGzcj > 240
ORDER BYzcj DESC;
二、

A.查询姓‘王’的学生的个数;
B. 查询“数学”比“语文”成绩高的所有学生的学号;
C.查询平均成绩大于90分的同学的学号和平均成绩。
三、第三题求平均成绩,不涉及到课程,只需要关联两张表即可
查询学生信息表中男生一共有多少人
查询男生成绩中前3名的成绩
查询男生成绩中排名第3的成绩