Consider the set of relations given below and the SQL query that follows…

2018

Consider the set of relations given below and the SQL query that follows

Students : (Roll number, Name, Date of birth)
Courses: (Course number, Course name, instructor)
Grades: (Roll number, Course number, Grade)
SELECT DISTINCT Name
FROM Students, Courses, Grades
WHERE Students.Roll_number = Grades.Roll_number
       AND Courses.Instructor =Sriram
       AND Courses.Course_number = Grades.Course_number
       AND Grades.Grade = A

Which of the following sets is computed by the above query?

  1. A.

    Names of Students who have got an A grade in all courses taught by Sriram

  2. B.

    Names of Students who have got an A grade in all courses

  3. C.

    Names of Students who have got an A grade in at least one of the courses taught by Sriram

  4. D.

    None of the above

Attempted by 212 students.

Show answer & explanation

Correct answer: C

The SQL query joins the Students, Courses, and Grades tables. It filters for courses taught by 'Sriram' where the grade is 'A'. The query selects distinct student names from this filtered set. Therefore, it returns the names of students who have received an 'A' in at least one course taught by Sriram.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro