CS FundamentalsHardTCS Digital · Infosys SP · GATE CS
Table Product(pid, cat, price) rows: (1, 'X', 10), (2, 'X', 20), (3, 'Y', 20), (4, NULL, 30), (5, 'Y', NULL), (6, 'Z', 5). What does this query return?
Table Product(pid, cat, price) rows: (1, 'X', 10), (2, 'X', 20), (3, 'Y', 20), (4, NULL, 30), (5, 'Y', NULL), (6, 'Z', 5).
What does this query return?
SELECT COUNT(*) FROM Product
WHERE price BETWEEN 10 AND 20
OR cat IN ('Z', NULL);- A. 5
- B. 4
- C. 3
- D. 6
Correct answer: B. 4
BETWEEN is inclusive: pids 1, 2, 3 match. cat IN ('Z', NULL) is TRUE for pid 6 (cat = 'Z'); for other rows it is FALSE or UNKNOWN. Total 4.
More DBMS and SQL questions
- Classify the schedule W3(B), R2(A), R3(B), W2(A), W1(B), R1(B).
- In a B+ tree every internal node can have at most 34 children and every leaf can hold at most 30 keys. With exactly 4 levels (root at…
- Table Stu(sid, sname) rows: (1, 'Om'), (2, 'Pia'), (3, 'Raj'), (4, 'Sia'). Table Takes(sid, cid, marks) rows: (1, 'C1', 80), (1, 'C2'…
- Relations R (1000 blocks) and S (500 blocks) are joined with block nested-loop join using M = 22 buffer blocks (M − 2 for the outer…
- T1: W1(A), W1(B) and T2: R2(A), R2(B). Of all 6 interleavings that keep each transaction's own order, how many are conflict serializable?
- Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4…