I've a table named ExamResult
which has following columns
studentId, Subject, Standard, Marks
and i've following values in my table
for studentId=1
1,maths,9,78
1,english,9,80
1,history,9,67
1,geography,9,90
for studentId=2
2,maths,9,68
2,english,9,83
2,history,9,70
2,geography,9,69
similar entries till studentId 30
now I want to calculate the percentage of each student and want to select data from the table with the following columns
studentName(from student table),Standard,Percentage(with highest percentage on top)
Eg:
Amit,9,78%
Sam,9,77%
now the problem is how to calculate this percentage in SQL,
select stu.name,exam.standard,(what to do here) as Percentage
from Student stu
inner join ExamResult exam
on stu.Id=exam.studentId;
Please help me