CS FundamentalsModerateGATE CS · TCS Digital
S(v) has rows 1, 2, 3 and U(v) has rows 2, NULL. What does SELECT COUNT(*) FROM S WHERE v NOT IN (SELECT v FROM U) return?
- A. 1
- B. 0
- C. 2
- D. 3
Correct answer: B. 0
For v = 1 and v = 3, 'v <> NULL' is UNKNOWN, so NOT IN is never TRUE and no row qualifies; v = 2 is excluded directly.
More DBMS and SQL questions
- A(x) holds 1, 2, 2, 3 and B(x) holds 2, 3, 3, 4. How many rows does SELECT x FROM A UNION SELECT x FROM B return?
- R(A, B, C) has the functional dependencies AB -> C and C -> B. Which is the highest normal form that R satisfies?
- T(v) holds 40, 10, 30, 20, 50. What does SELECT v FROM T ORDER BY v DESC LIMIT 2 OFFSET 1 return, in order?
- T(x) holds 10, NULL, 20, 30, NULL. What does SELECT AVG(x) FROM T return?
- A bank's server crashes immediately after a transaction commits, before its changes are written to the data files. After restart the…
- Sc(n, s) holds (a, 90), (b, 85), (c, 85), (d, 80), (e, 70). For the row of n = 'd', what are RANK() OVER (ORDER BY s DESC) and DENSERANK()…