网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
查询学生的总成绩,并进行排名,总分重复时不保留名次空缺 SELECT sc.SId, DENSE_RANK() OVER(ORDER BY sum(sc.score) DESC)排名, sum(sc.score) as sumscore FROM sc GROUP BY sc.SId ORDER BY sumscore DESC;
参考答案和解析
SELECTsno,gradeFROMscWHEREgradeBETWEEN70 AND80ORDERBYgradeASCSELECTsno,gradeFROMscWHEREgrade>=70 ANDgrade=80ORDERBYgradeASC
更多 “查询学生的总成绩,并进行排名,总分重复时不保留名次空缺 SELECT sc.SId, DENSE_RANK() OVER(ORDER BY sum(sc.score) DESC)排名, sum(sc.score) as sumscore FROM sc GROUP BY sc.SId ORDER BY sumscore DESC;” 相关考题
考题
若要求“查询选修了3门以上课程的学生的学生号”,正确的SQL语句是A.SELECT S# FROM SC GROUP BY S# WHERE COUNT(*) 3B.SELECT S# FROM SC GROUP BY S# HAVING COUNT(*) 3C.SELECT S# FROM SC ORDER BY S# WHERE COUNT(*) 3D.SELECT S# FROM SC ORDER BY S# HAVING COUNT(*) 3
考题
用SQL语言检索选修课程在5门以上(含5门)的学生的学号、姓名和平均成绩,并按平均成绩降序排序,正确的命令是A)SELECT S.学号,姓名,平均成绩FROM S,SC; WHERE S.学号=SC.学号; GROUP BY S.学号HAVING GOUNT(*)=5 ORDER BY平均成绩DESCB)SELECT学号,姓名,AVG(成绩)FROM S,SC; WHERE S.学号SC.学号AND COUNT(*)>=5; GROUP BY学号ORDER BY 3 DESCC)SELECT S.学号,姓名,AVG(成绩)平均成绩FROM S,SC; WHERE S.学号=SC.学号AND COUNT(*)=5; GROUP BY S.学号ORDER BY平均成绩DESCD)SELECT S.学号,姓名,AVG(成绩)平均成绩FROM S,SC; WHERE S.学号=SC.学号; GROUP BY S.学号HAVING COUNT(*)=5 ORDER BY 3 DESC
考题
假设每个歌手的“最后得分”的计算方法是:去掉一个最高分和一个最低分,取剩下分数的平均分。根据“评分”表求每个歌手的“最后得分”并存储于表TEMP中,表 TEMP中有两个字段:“歌手号”和“最后得分”,并且按最后得分降序排列,生成表 TEMP的SQL语句是 ______。A.SELECT歌手号,(COUNT(分数)-MAX(分数)-MIN(分数)/SUM(*)-2)最后得分; FROM评分INTO DBF TEMP GROUP BY歌手号ORDER BY最后得分DESCB.SELECT歌手号,(COUNT(分数)-MAX(分数)-MIN(分数)/(SUM(*)-2)最后得分; FROM评分INTO DBF TEMP GROUP BY评委号ORDER BY最后得分DESCC.SELECT歌手号,(SUM(分数)-MAX(分数)-MIN(分数)/COUNT(*)-2)最后得分; FROM评分INTO DBF TEMP GROUP BY评委号ORDER BY最后得分DESCD.SELECT歌手号,(SUM(分数)-MAX(分数)-MIN(分数)/COUNT(*)-2)最后得分; FROM评分INTO DBF TEMP GROUP BY歌手号ORDER BY最后得分DESC
考题
检索选修四门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩降序排列出来,正确的SELECT语句是______。A.SELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 CROUP BY S# ORDER BY 2 DESC HAVING COUNT(*)>=4B.SELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY 2 DESCC.SELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY 2 DESCD.DELECT S#,SUM(GRADE)FROM SC WHERE GRADE>=60 ORDER BY 2 DESC CROUP BY S# HAVING COUNT(*)>=4
考题
设有学生表S(学号,姓名,性别,年龄),查询所有年龄小于等于18岁的女同学、并按年龄进行降序排序生成新的表WS,正确的SQL命令是______。A.SELECT * FROM S WHERE 性别='女' AND 年龄<=18 ORDER BY 4 DESC INTO TABLE WSB.SELECT * FROM S WHERE 性别='女' AND 年龄<=18 ORDER BY 年龄 INTO TABLE WSC.SELECT * FROM S WHERE 性别='女' AND 年龄<=18 ORDER BY '年龄' DESC INTO TABLE WSD.SELECT * FROM S WHERE 性别='女' OR 年龄<=18 ORDER BY '年龄' ASC INTO TABLE WS
考题
统计每个部门中人数( )A.SELECT SUM(ID) FROM EMP GROUP BY DEPTNO;B.SELECT SUM(ID) FROM EMP ORDER BY DEPTNO;C.SELECT COUNT(ID) FROM EMP ORDER BY DEPTNO;D.SELECT COUNT(ID) FROM EMP GROUP BY DEPTNO;
考题
设有学生表 S( 学号 , 姓名 , 性别 , 年龄 ) ,查询所有年龄小于等于 18 岁的女同学,并按年龄进行降序排序生成新的表 WS ,正确的 SQL 命令是A) SELECT * FROM S WHERE 性别 =' 女 ' AND 年龄 =18 ORDER BY 4 DESC INTO TABLE WSB) SELECT * FROM S WHERE 性别 =' 女 ' AND 年龄 =18 ORDER BY 年龄 INTO TABLE WSC) SELECT * FROM S WHERE 性别 =' 女 ' AND 年龄 =18 ORDER BY ' 年龄 ' DESC INTO TABLE WSD) SELECT * FROM S WHERE 性别 =' 女 ' OR 年龄 =18 ORDER BY ' 年龄 ' ASC INTO TABLE WS
考题
关系模式SCS(Sno,Cno,Score)中,Sno是学生学号,Cno是课程号,Score是成绩。若要查询每门课成绩的平均成绩,且要求查询结果按平均成绩升序排列,平均成绩相同时,按课程号降序排列,可用SQL语言写为(33)。若查询结果仅限于平均分数超过85分的,则应(34)。(51)A.SELECT Cno,AVG(Score)FROM SCS GROUP BY Score ORDER BY 2.Cno DESCB.SELECT Cno,AVG(Score) FROM SCS GROUP BY Cno ORDER BY 2.Cno DESCC.SELECT Cno,AVG(Score) FROM SCS ORDER BY Cno DESC ORDER BY ScoreD.SELECT Cno,AVG(Score) FROM SCS GROUP BY AVG(Score)ORDER BY Cno DESC
考题
The STUDENT_GRADES table has these columns:The register has requested a report listing the students‘ grade point averages (GPA), sorted from highest grade point average to lowest within each semester, starting from the earliest date. Which statement accomplishes this?()A. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end DESC, gpa DESC;B. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end ASC, gpa ASC;C. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end, gpa DESC;D. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY gpa DESC, semester_end DESC;E. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY gpa DESC, semester_end ASC;
考题
根据选课表(学号、课程号、成绩)进行下列查询: SELECT学号,SUM(成绩)AS总分FROM选课表WHERE(学号="C1011101") GROUP BY学号 UNION SELECT学号,SUM(成绩)AS总分FROM选课表WHERE(学号="C1011102") GROUP BY学号 使用的是______。A.合并查询B.外连接查询C.自身连接查询D.子查询
考题
在成绩表中要求按“总分”降序排列,并查询前3名学生的记录,正确的命令是A.SELECT * TOP 3 FROM成绩表; WHERE总分DESCB.SELECT * TOP 3 FROM成绩表; FOR总分DESCC.SELECT * TOP 3 FROM成绩表; GROUP BY总分DESCD.SELECT * TOP 3FROM成绩表; ORDER BY总分DESC
考题
查询金额最大的那10%订单的信息。正确的SQL语句是A.SELECT*TOP l0 PERCENT FROM订单B.SELECT TOP l0%*FROM 订单 ORDER BY金额C.SELECT*TOP l0 PERCENT FROM 订单 ORDER BY 金额D.SELECT TOP l0 PERCENT*FROM 订单 ORDER BY 金额 DESC
考题
欲将表“学生”中的信息先按学号升序排序,再按平均成绩升序排列,其正确命令是(45)。A.SELECT * FROM 学生 ORDER BY 学号 ASC,平均成绩 ASCB.SELECT * FROM 学生 ORDER BY 平均成绩 ASC,学号 ASCC.SELECT * FROM 学生 ORDER BY 学号 DESC,平均成绩 DESCD.SELECT * FROM 学生 ORDER BY 平均成绩 DESC,学号 DESC
考题
若需在“选课”表中按降序排列查询前3名的学生,下列语法正确的是( )。A.SELECT 学生号,成绩 TOP 3 FROM 选课; ORDER BY 成绩 DESCB. SELECT 学生号,成绩 TOP 3 PERCENT FROM 选课: ORDER BY 成绩 DESCC.SELECT 学生号,成绩 TOP 3 FROM 选课 DESC:D. SELECT 学生号,成绩 TOP 3 PERCENT FROM 选课 DESC
考题
设关系模式SCG (S#, C#, grade)中S#为学生学号,C#为课程号,grade为某学号学生学某号课程的考试成绩。今要查询每门课程的平均成绩,且要求查询的结果按平均成绩升序排列,平均成绩相同时,按课程号降序排列,则用SQL查询语言应为(1)。若查询的结果仅限于平均分数超过80分的,则应(2)。A.Select C#,AVG(grade) From SCG Group by grade Order by 2,C# DescB.Select C#,AVG(grade) From SCG Group by C# Order by 2,C# DescC.Select C#,AVG(grade) From SCG Where C#,AVG Desc Group by gradeD.Select C#,AVG(grade) From SCG Group by AVG(grade) Order by 2,C# Desc
考题
在学生选课表(SC) 中,查询选修了3号课程(课程号CH)的学生的学号(XH)及其成绩(GD) 。查询结果按分数的降序排列。实现该功能的正确SQL语句( )。A.SELECR XH,GD FROM SC WHERE CH='3' ORDER BY GD DESC:B.SELECT XH,GD FROM SC WHERE CH='3' ORDER BY GD ASC;C.SELECT XH,GD FROM SC WHERE CH='3'GROUP BY GD DESC;D.SELECT XH,GD FROM SC WHERE CH='3' GROUP BY GD ASC;
考题
求选课在3门以上且各门课程均及格的学生的学号及总成绩,查询结果按总成绩降序排列。请对下列的SELECT语句填空: SELECT学号,SUM(成绩) AS 总成绩 FROM 选课表; WHERE 成绩>=60【 】ORDER BY【 】DESC
考题
检索选修四门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩的降序排列出来。正确的SELECT语句是______。A.SELECT S#, SUM(GRADE) FROM SC WHERE GRADE>=60 GROUP BY S# ORDER BY 2 DESC HAVING COUNT(*)>=4B.SELECT S#, SUM(GRADE) FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY 2 DESCC.SELECT S#, SUM(GRADE) FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY 2 DESCD.SELECT S#, SUM(GRADE)FROM SC WHERE GRADE>=60 ORDER BY 2 DESC GROUP BY S# HAVING COUNT(*)>=4
考题
要从学生表(学号、姓名、性别、出生年月、入校总分、三好生)中查询入校总分最高的3个学生的记录,应使用的SELECT SQL语句是 ______。A.SELECT*FROM学生表ORDER BY入校总分ASCB.SELECT FROM学生表ORDER BY入校总分DESCC.SELECT FROM学生表TOP 3 ORDER BY入校总分ASCD.SELECT FROM学生表TOP 3 ORDER BY入校总分DESC
考题
学生选课的关系模式为SC(SN,CN,SM),其中SN为学号,CN为课程号,SM为成绩。检索选修3门以上课程的学生总成绩,并按总成绩的降序排列。 SELECT SN,SUM(SM) FROM SC ______0RDER BY 2 DESC;A.GROUP BY SN HAVING COUNT(*)>=3B.HAVINGCOUNT(*)>=3 GROUP BY SNC.GROUP BY SM HAVING COUNT(*)>=3D.HAVING COUNT(*)>=3 GROUP BY SM
考题
BookStore数据库中有销售明细表OrderDetail(OrderCode,BookCode,Amount)查询销售总量前20%的图书,并按总销量降序排列。SQL语句:SELECT TOP 20 PERCENT Bookcode As书号,SUM(Amount)As总销量ROMOrderDetail GROUP BY Book code ORDER BY()A、AmountDESCB、SUM(Amount)DESCC、COUNT(Amount)DESCD、ADD(Amount)DESC
考题
下面哪条语句可以取出薪水最高的前三个人:()A、SELECT * FROM (SELECT * FROM EMPLOYEES ORDER BY SALARY );B、SELECT * FROM (SELECT * FROM EMPLOYEES ORDER BY SALARY ) WHERE ROWNUM=3;C、SELECT * FROM (SELECT * FROM EMPLOYEES ORDER BY SALARY DESC) WHERE ROWNUM=3;D、SELECT * FROM EMPLOYEES WHERE ROWNUM=3 ORDER BY SALARY DESC;
考题
下列查询年龄最大的前四个学生(包括并列的情况)的语句,正确的是()。A、SELECT TOP 4 WITH TIES * FROM Student ORDER BY Sage ASCB、SELECT TOP 4 WITH TIES * FROM Student GROUP BY Sage ASCC、SELECT TOP 4 WITH TIES * FROM Student ORDER BY Sage DESCD、SELECT TOP 4 WITH TIES * FROM Student GROUP BY Sage DESC
考题
查询金额最大的那10%订单的信息。正确的SQL语句是()。A、SELECT * TOP 10 PERCENT FROM 订单B、SELECT TOP 10% * FROM 订单 ORDER BY 金额C、SELEC T* TOP 10 PERCENT FROM 订单 ORDER BY 金额D、SELECT TOP 10 PERCENT * FROM 订单 ORDER BY 金额 DESC
考题
假设订单表orders用来存储订单信息,cid代表客户编号,money代表单次订购额,现要查询每个客户的订购次数和每个客户的订购总金额,下面()sql语句可以返回正确结果。A、select cid,count(distinct(cid)),sum(money) from orders group by cidB、select cid,count(distinct(cid)),sum(money) from orders order by cidC、select cid,count(cid),sum(money) from orders order by cidD、select cid,count(cid),sum(money) from orders group by cid
考题
单选题BookStore数据库中有销售明细表OrderDetail(OrderCode,BookCode,Amount)查询销售总量前20%的图书,并按总销量降序排列。SQL语句:SELECT TOP 20 PERCENT Bookcode As书号,SUM(Amount)As总销量ROMOrderDetail GROUP BY Book code ORDER BY()A
AmountDESCB
SUM(Amount)DESCC
COUNT(Amount)DESCD
ADD(Amount)DESC
考题
单选题下面哪条语句可以取出薪水最高的前三个人:()A
SELECT * FROM (SELECT * FROM EMPLOYEES ORDER BY SALARY );B
SELECT * FROM (SELECT * FROM EMPLOYEES ORDER BY SALARY ) WHERE ROWNUM=3;C
SELECT * FROM (SELECT * FROM EMPLOYEES ORDER BY SALARY DESC) WHERE ROWNUM=3;D
SELECT * FROM EMPLOYEES WHERE ROWNUM=3 ORDER BY SALARY DESC;
热门标签
最新试卷