Write a sql query to display the subject name and the maximum marks scored in a subject ordered by subject name. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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

14th Aug 2017, 6:46 AM
Shraddha Bhangale
Shraddha Bhangale - avatar
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.
14th Aug 2017, 8:47 AM
deFault