GATE IT 2008 · SQL Queries

MCQ · 2 marks · Problem DBMS-SQL-0115

Consider the following relational schema:Student(school-id,sch-roll-no,sname,saddress) School(school-id,sch-name,sch-address,sch-phone) Enrolment(school-id,sch-roll-no,erollno,examname)
ExamResult(erollno,examname,marks)
What does the following SQL query output?SELECT    sch-name, COUNT (*)
FROM    School C, Enrolment E, ExamResult R
WHERE    E.school-id = C.school-id
AND E.examname = R.examname AND E.erollno = R.erollno AND
R.marks = 100 AND S.school-id IN (SELECT school-id
                                FROM student
                                GROUP BY school-id
                                 HAVING COUNT (*) > 200)
GROUP By school-id
  1. A
    for each school with more than 200 students appearing in exams, the name of the school and the number of 100's scored by its students
  2. B
    for each school with more than 200 students in it, the name of the school and the number of 100's scored by its students
  3. C
    for each school with more than 200 students in it, the name of the school and the number of its students scoring 100 in at least one exam
  4. D
    nothing; the query has a syntax error

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solutionOfficial GATE Answer Key: Option D.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/3388/gate2008-it-74

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com