SELECT, WHERE & ORDER BY · Question 19 · Hard

SELECT, WHERE & ORDER BY question 19

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 marks NOT IN (91, NULL);
  1. 3 rows
  2. 4 rows
  3. 5 rows
  4. 0 rows
Answer and explanation

Answer: D. 0 rows

Explanation: marks NOT IN (91, NULL) means marks <> 91 AND marks <> NULL. The second comparison is never true, so the condition is false for 91 and unknown for every other row, and no row is returned.

Previous: Table Payments: txn_id | payer | app | amount | status 1 | Farhan | GPay | 250… · Next: Table Students: roll | name | city | marks 1 | Aarav | Pune | 78 2 | Diya |…

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