CS FundamentalsModerateTCS Digital · Infosys SP · GATE CS

Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4, 'Dev', 'Tech', NULL, 3), (5, 'Esha', NULL, 35, 3), (6, 'Farid', 'Tech', 70, 2). How many rows does this query return?

Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4, 'Dev', 'Tech', NULL, 3), (5, 'Esha', NULL, 35, 3), (6, 'Farid', 'Tech', 70, 2). How many rows does this query return?
SELECT name FROM Staff
WHERE pay > 50 OR pay <= 50;
  1. A. 4
  2. B. 5
  3. C. 6
  4. D. 0

Correct answer: B. 5

For Dev both comparisons are UNKNOWN and UNKNOWN OR UNKNOWN is UNKNOWN, so his row is dropped even though the condition looks like a tautology: 5 rows.

More DBMS and SQL questions

Exams that ask this topic