求解应聘一个公司笔试的Sql题!!!

jfei793 2003-11-30 04:33:43
表A(S#,C#,grand)其中S#为学号 C#为课程号 grand该学生对应课程的成绩
要求写出SQL语句查询结果为
1.按各科的平均成绩降序排列出各条记录,如有平均成绩相同的学科则,
相同成绩的记录按课程号升序排列。
2.以上再加上一条要求输出的记录平均成绩在80以上!
...全文
58 34 打赏 收藏 转发到动态 举报
写回复
用AI写文章
34 条回复
切换为时间正序
请发表友善的回复…
发表回复
jfei793 2003-12-19
  • 打赏
  • 举报
回复
百家争鸣。我晕!
new_life 2003-12-19
  • 打赏
  • 举报
回复
select C#,avg(grand) from Table1 order by 2 asc, 1 desc group by C#
select C#,avg(grand) from Table1 order by 2 asc, 1 desc group by C# having avg(grand)>80
ghosthjt 2003-12-19
  • 打赏
  • 举报
回复
呵呵,简单的题目呀。
erigido 2003-12-19
  • 打赏
  • 举报
回复
经典题目啊
feeling_68 2003-12-19
  • 打赏
  • 举报
回复

1:select s#,c# ,avg(grand) from a group by c# order by avg(grand) desc,c# asc
2:select s#,c#,avg(grand) from a group by c# having avg(grand)>80 order by avg(grand) desc,c# asc
pwzhu666 2003-12-19
  • 打赏
  • 举报
回复
select c#,avg(grand) from table group by c# where avg(grand)>80 order by c# desc
hanwen 2003-12-19
  • 打赏
  • 举报
回复
1:select c# ,avg(grand) from A group by c# order by avg(grand) desc,c#
2:select c#,avg(grand) from A group by c# having avg(grand)>80 order by avg(grand) desc,c#
不合你的要求??
cloudchen 2003-12-19
  • 打赏
  • 举报
回复
这个做考题不太适合吧。。。
jackiehua 2003-12-19
  • 打赏
  • 举报
回复
1.select avg(grade),c# from a group by c# order by 2

2.select avg(grade),c# from a group by c# having avg(grade)>=80 order by 2

raymond323 2003-12-18
  • 打赏
  • 举报
回复
up
spidertan 2003-12-18
  • 打赏
  • 举报
回复
up
hopeweb 2003-12-18
  • 打赏
  • 举报
回复
以上写了很多,但还没有真正完全符合题意的。包手括我的在内。关注中。
hopeweb 2003-12-18
  • 打赏
  • 举报
回复
select s#,c#,grand from a
group by s#,c#,grand
having avg(grand)>80
order by avg(grand) desc
donghb8 2003-12-18
  • 打赏
  • 举报
回复
支持:8LY8Apollo(阿波罗)
他的已经能够实现了
devilwind 2003-12-18
  • 打赏
  • 举报
回复
感觉这个问题问的就有问题!
mnm0756 2003-12-17
  • 打赏
  • 举报
回复
都写了,不用我说了吧...
bunnysky 2003-12-17
  • 打赏
  • 举报
回复
很Easy
写了这么多了,帮你顶一下吧!
mfjun007 2003-12-17
  • 打赏
  • 举报
回复
按题意,应该可以这样:
1:select s#,c# ,avg(grand) from table group by c# order by avg(grand) desc,c#
2:select s#,c#,avg(grand) from table group by c# having avg(grand)>80 order by avg(grand) desc,c#
playyuer 2003-12-17
  • 打赏
  • 举报
回复
easy
sdhdy 2003-12-17
  • 打赏
  • 举报
回复
--应该是一条SQL语句的
select c#,avg(grand) 平均成绩 from 表A group by c# having avg(grand)>=80 order by avg(grand) desc,c#
加载更多回复(14)

34,874

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧