The answer is 2 as there are only 2 distinct student names.
SELECT S.studentName, Sum(p.marks)
FROM student S, performance P
WHERE S.rollno= P.rollno
This query will return only 1 Row. Confused?
SELECT distinct S.studentName, Sum(p.marks)
FROM student S, performance P
WHERE S.rollno= P.rollno
This will also return 1 row
SELECT S.studentName
FROM student S, performance P
WHERE S.rollno= P.rollno
This will return 6 rows.
SELECT distinct S.studentName
FROM student S, performance P
WHERE S.rollno= P.rollno
This will return 2 rows
Below is the result of the given query. Note that there are only two student names and query prints sum(P.Marks) for every student.
Student_Name Marks
Raj 310
Rohit 140