776 views

1 Answer

0 votes
0 votes

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 

 

Related questions

886
views
0 answers
0 votes
mukul maurya asked Sep 1, 2018
886 views
904
views
0 answers
0 votes
mukul maurya asked Sep 1, 2018
904 views
585
views
1 answers
0 votes
mukul maurya asked Sep 1, 2018
585 views
2.2k
views
1 answers
0 votes
mukul maurya asked Sep 1, 2018
2,227 views
Identify the valid data type which can be used in sql to define type of data ?a. varcharb. memoc. numericd. string