Question:

Consider the table Student with attributes (rollNum, name, gender, marks). The primary key is rollNum. The SQL query is:
SELECT *
FROM Student
WHERE gender = 'F' AND marks > 65;
The number of rows returned by this query is:

Show Hint

Always check the inequality carefully: marks>65} excludes rows where marks $=65$. Equality requires >=}.
Updated On: Aug 26, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

Step 1: Table data.
\[ \begin{array}{|c|c|c|c|} \hline \text{rollNum} & \text{name} & \text{gender} & \text{marks} \\ \hline 1 & \text{Naman} & M & 62 \\ 2 & \text{Aliya} & F & 70 \\ 3 & \text{Aliya} & F & 80 \\ 4 & \text{James} & M & 82 \\ 5 & \text{Swati} & F & 65 \\ \hline \end{array} \] Step 2: Apply condition.
The query requires: gender = 'F' and marks > 65.
- Row 2: Aliya, F, 70 ⇒ satisfies.
- Row 3: Aliya, F, 80 ⇒ satisfies.
- Row 5: Swati, F, 65 ⇒ does not satisfy (65 is not > 65).

Step 3: Count results.
Only rows 2 and 3 qualify. Total = 2 rows.
\[ \boxed{2} \]
Was this answer helpful?
0
0

Questions Asked in GATE CS exam

View More Questions