SELECT, WHERE & ORDER BY · Question 17 · Hard

SELECT, WHERE & ORDER BY question 17

Table Students:
roll | name | city | marks
1 | Aarav | Pune | 78
2 | Diya | Mumbai | 91
3 | Kabir | Pune | 64
4 | Meena | Chennai | 91
5 | Rohan | Mumbai | NULL
6 | Sneha | Pune | 85

How many students does this query return?

SELECT name
FROM Students
WHERE NOT (city = 'Pune' OR marks > 80);
  1. 0 rows
  2. 1 row
  3. 2 rows
  4. 3 rows
Answer and explanation

Answer: A. 0 rows

Explanation: The bracket is true for every Pune student and for Diya and Meena (91), so NOT makes those false. For Rohan it is FALSE OR NULL = NULL, and NOT NULL is still NULL, so even his row is not returned.

Previous: Table Products: pid | name | category | price | stock 1 | Kurta | Clothing |… · Next: Table Payments: txn_id | payer | app | amount | status 1 | Farhan | GPay | 250…

Practise select, where & order by

Try a fresh set of select, where & order by questions with an explanation after every answer, free and without signing up: SELECT, WHERE & ORDER BY practice. Or sit a full placement mock test.

More select, where & order by questions

More sql practice

SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge