Consider the query: SELECT student_name FROM students WHERE class_name =…

2007

Consider the query:

SELECT student_name
FROM students
WHERE class_name = (SELECT class_name
          FROM students
          WHERE math_marks = 100);

What will be the output?

  1. A.

    the list of names of students with 100 marks in mathematics

  2. B.

    the names of all students of all classes in which at least one student has 100 marks in mathematics

  3. C.

    the names of all students in all classes having 100 marks in mathematics

  4. D.

    the names and class of all students whose marks in mathematics is 100

Attempted by 126 students.

Show answer & explanation

Correct answer: B

The subquery identifies class names where math_marks equal 100. The main query retrieves student names from those specific classes. This means all students in those classes are returned, not only those with 100 marks.

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

Explore the full course: Mppsc Assistant Professor