学号 学生姓名 课程名称 成绩(只显示每科最高分)
oracle 里可以这样用:
select a.studentid as "学  号",studentname "学生姓名",
subjectname "课程名称",mark "成  绩"
from student a , subject b , grade c
where a.studentid = c.studentid
and b.subjectid = c.subjectid
and (b.subjectid,mark) in(select subjectid,max(mark)  from grade group by subjectid)
;

/**************************************************************************/

alter table grade add (ord number(3));
update grade a set ord = (
       select count(*)+1 from grade where a.mark > mark
)

alter table grade add (ord2 number(3));
update grade a set ord2 = (
       select count(*)+1 from grade where a.mark < mark
)

select * from grade;

相关文章:

  • 2022-12-23
  • 2021-05-27
  • 2021-05-16
  • 2021-11-18
  • 2021-12-12
  • 2021-11-08
  • 2021-11-21
  • 2021-10-30
猜你喜欢
  • 2021-05-26
  • 2022-12-23
  • 2022-02-02
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案