create table student( sID int IDentity(1,1) primary key, sname varchar(20) not null)create table coures( cID int IDentity(1, cname varchar(20))create table score( scID int IDentity(1, sID int not null, cID int not null, result float)insert into student values('张学友')insert into student values('吴孟达')insert into student values('张柏芝')insert into student values('曹阿瞒')insert into student values('张牛俊')insert into coures values('计算机科学与应用')insert into coures values('高等数学')insert into coures values('线性代数')insert into score values(1,1,80)insert into score values(1,2,78)insert into score values(1,3,59)insert into score values(2,84)insert into score values(2,90)insert into score values(2,45)insert into score values(3,23)insert into score values(3,87)insert into score values(4,100)select * from student select * from couresselect * from score--查询出 各个科目的前三名(圆满解决)select cID,result from score s group by cID,result having resultin( select top 3 result from score where cID = s.cID order by result desc)order by cID,result desc
总结以上是内存溢出为你收集整理的有学生科目成绩表这三张表要求查处各个科目的前三名成绩全部内容,希望文章能够帮你解决有学生科目成绩表这三张表要求查处各个科目的前三名成绩所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)