【发布时间】:2022-01-09 01:52:50
【问题描述】:
我的数据库中有以下查询,我想添加一个新列来处理学生的最终 Apperciation: 查询:
select student_name,q4.percentage
from (select q2.student_id,mark *100/total as Percentage
from (select class_id,sum(max_mark)as total
from course
group by(class_id)
)q1 ,
(select sum(mark) as mark,student_id
from grades
group by(student_id)
) q2
where q2.student_id in (select student_id
from student
where student.section_id in(select section_id
from section
where class_id=q1.class_id)
)
order by q2.student_id
) q4
inner join student on q4.student_id=student.student_id;
结果如下: enter image description here
| STUDENT_NAME | PERCENTAGE |
|---|---|
| Massoud | 50.41667 |
| Ali-Shbeeb | 84.16667 |
| Mona | 75.2941 |
现在我只需要在结果中添加一个新列,就像一个奖项一样 所以表格是这样的:
student_name percetage award
mahmoud-kabbani 79.166667 B
Kareem-Alshaeer 54.583 c
【问题讨论】:
-
在栏目奖项中决定提出哪个角色的标准是什么?
-
if percetage >80 is A if percetage >60 is B if percetage >40 is C else E
-
Why not upload images of code/errors when asking a question?,所以我在文本中添加了图片示例。
标签: mysql database oracle datatables return-value