Oracle query to find the maximum of total

by Devadutta
(India)

I have the below student table with rows like this


Hide Copy Code
student_id subject_id Mark
1 1 60
1 2 55
1 3 70
2 1 80
2 2 40
2 3 50
3 1 30
3 2 40
3 3 60



I need to find the student_id who has got maximum total marks.Could anyone please help.

Thanks

Comments for Oracle query to find the maximum of total

Average Rating starstarstarstar

Click here to add your own comments

Mar 27, 2017
Rating
starstarstar
pfa NEW
by: PRASHANT

SELECT MAX(MARKS) FROM (SELECT SUM(MARK) MARKS FROM STU_DE GROUP BY STUDENT_ID)

Oct 26, 2016
Rating
starstarstarstarstar

by: John

To solve this all you need to do is put in the following sql query, replacing table_name with the actual name of your table.

SELECT Student_ID, MAX(Mark) AS HighestMark FROM table_name;

The result would then be something like this

Number of Records: 1
StudentID HighestMark
2 80

Click here to add your own comments

Join in and write your own page! It's easy to do. How? Simply click here to return to Oracle Questions.