Consider the following table named Student in a relational database. The…

2023

Consider the following table named Student in a relational database. The primary key of this table is rollNum.

rollNum      Name       Gender      Marks

1                Naman          M              62

2                Aliya              F              70

3                Aliya              F              80

4              James            M              82

5               Swati              F              65

The SQL query below is executed on this database

        SELECT *

        FROM Student

        WHERE gender = ‘F’ AND  marks > 65;

The number of rows returned by the query is ______.

Attempted by 505 students.

Show answer & explanation

Correct answer: 2

Answer: 2 rows

Explanation: Apply the WHERE conditions step by step.

  • Step 1 — Keep only female students (gender = 'F'): rollNum 2 — Name: Aliya — Marks: 70; rollNum 3 — Name: Aliya — Marks: 80; rollNum 5 — Name: Swati — Marks: 65.

  • Step 2 — From these, keep only those with marks > 65: rollNum 2 — Aliya — 70; rollNum 3 — Aliya — 80. (rollNum 5 has 65 which is not greater than 65.)

Therefore, the query returns 2 rows.

Explore the full course: Gate Guidance By Sanchit Sir