Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

(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

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.