昆明北京網(wǎng)站建設(shè)產(chǎn)品經(jīng)理培訓(xùn)哪個機構(gòu)好
一、現(xiàn)有以下兩張表:
第一張表名為cust,其表結(jié)構(gòu)如下:

第二張表名為mark,其表結(jié)構(gòu)如下:

1) [5分]請寫出計算 所有學(xué)生的英語平均成績的sq|語句。
2) [5分]現(xiàn)有五 個學(xué)生,其學(xué)號假定分別為11,22,33,44,55;請用一條SQL語句實現(xiàn)列出這五個學(xué)生的數(shù)學(xué)成績及其姓名、學(xué)生地址、電話號碼;
3)[5分]查詢所有學(xué)生的姓名、計算機成績,按照計算機成績從高到低排序;
[5分]查詢所有總成績大于240分的學(xué)生學(xué)號、姓名、總成績,按照總成績從高到低排序;
答案:
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.查詢姓‘王’的學(xué)生的個數(shù);
B. 查詢“數(shù)學(xué)”比“語文”成績高的所有學(xué)生的學(xué)號;
C.查詢平均成績大于90分的同學(xué)的學(xué)號和平均成績。
三、第三題求平均成績,不涉及到課程,只需要關(guān)聯(lián)兩張表即可
查詢學(xué)生信息表中男生一共有多少人
查詢男生成績中前3名的成績
查詢男生成績中排名第3的成績