+ 1
Write a sql query to display the subject name and the maximum marks scored in a subject ordered by subject name.
Subject table : subjectname,subjectid Mark table: subjectid,value, studentid student: studentid
1 ответ
+ 1
Something like:
select
sub.subjectname,
max(m.value)
from subject sub
inner join mark m
on m.subjectid = sub.subjectid
group by sub.subjectname
order by sub.subjectname
This will output only subjects that have scores.
To show all subjects, even those with no scores, change inner to left.