Answer - D.
Consider the above 2 queries :
SELECT AVG(marks) FROM Student
This query will query all the records in the student table and will give out average marks of all .
i.e. (sum of all marks) / (total number of rows).
Consider the other query-
SELECT section from Student where sex = 'M' group by section
This will return sections of the student's tables where student sex='M'
Consider a table:
name |
sex |
section |
a |
m |
1 |
b |
m |
2 |
c |
f |
2 |
d |
m |
3 |
e |
m |
3 |
Query : select * from students where sex = 'm' group by section
Output :
name |
sex |
section |
a |
m |
1 |
b |
m |
2 |
e |
m |
3 |
Now, finally
SELECT section from Student where sex = 'M' group by section having AVG(marks) > SELECT AVG(marks) FROM Student
===
section of males having avg marks > avg marks of students