GATE 2023 CS – Question 61
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`.
| rollNum | name | gender | marks | passes? |
|---|---|---|---|---|
| 1 | Naman | M | 62 | no (male) |
| 2 | Aliya | F | 70 | **yes** |
| 3 | Aliya | F | 80 | **yes** |
| 4 | James | M | 82 | no (male) |
| 5 | Swati | F | 65 | no (65 is not greater than 65) |
The query returns **2** rows.
More Relational Model: Relational Algebra, Tuple Calculus, SQL questions
- GATE 2022 CS Q25
- GATE 2022 CS Q56
- GATE 2021 CS (CS1) Q33
- GATE 2021 CS (CS1) Q37
- GATE 2020 CS Q23
- GATE 2019 CS Q61
All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →