The GATE Grind

GATE 2023 CS – Question 61

Databases · Relational Model: Relational Algebra, Tuple Calculus, SQL · 2 marks · Numerical answer

Consider the following table named Student in a relational database. The primary key of this table is rollNum.
Student(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 ______.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 2

Explanation

The `WHERE` clause keeps rows with `gender = 'F'` and `marks > 65`.

rollNumnamegendermarkspasses?
1NamanM62no (male)
2AliyaF70**yes**
3AliyaF80**yes**
4JamesM82no (male)
5SwatiF65no (65 is not greater than 65)

The query returns **2** rows.

More Relational Model: Relational Algebra, Tuple Calculus, SQL questions

All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →