(ii) SELECT SNAME, SECTION FROM STUDENT WHERE MARKS > (SELECT AVG(MARKS) FROM STUDENT);
Answer:
Answer by student
The output of the SQL query is:
SNAME |
SECTION |
PRIYA |
2 |
RAVI |
1 |
RAMESH |
1
|
Detailed answer by teachoo
The given query selects the SNAME and SECTION columns from the table STUDENT, but only for those rows where the MARKS column is greater than the average of the MARKS column from the whole table . This means that it will only consider the students who have scored above the average marks . The average of the MARKS column from the whole table is (85+90+75+80+70+65+95+60)/8 = 77.5. Therefore, the output of this query is:
SNAME |
SECTION |
PRIYA |
2 |
RAVI |
1 |
RAMESH |
1 |