Multiple choice

SELECT STUDENT_ID, MARKS FROM STUDENTS WHERE MARKS > ( SELECT MARKS FROM STUDENTS WHERE STUDENT_ID = 123 )

What will be the output of the above query? Assume STUDENT_ID to be a primary key column.

  1. It always returns only one row with STUDENT_ID 123.

  2. It does not return any row as MARKS cannot be compared with STUDENT_ID.

  3. It returns n number of rows, where n is the number of students whose marks are greater than that of student whose STUDENT_ID is 123.

  4. It returns all the rows in the query.

  5. There is syntax error in the query.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Yes, it returns n number of rows, where n is the number of students whose marks are greater than that of student whose STUDENT_ID is 123. So, this option is correct.