CS FundamentalsVery hardGATE CS
A(x) = (3, 5, NULL, 8, 9, 12) and B(x) = (4, NULL, 6). How many rows does SELECT x FROM A WHERE x > ALL (SELECT x FROM B) return? (ALL is true only if the comparison is TRUE for every row of the subquery; one UNKNOWN comparison makes the result not TRUE.)
- A. 0
- B. 3
- C. 1
- D. 2
Correct answer: A. 0
B contains a NULL, so for every x the comparison with that row is UNKNOWN and x > ALL can never be TRUE: the result is 0 rows. Ignoring the NULL (largest non-NULL value 6) would wrongly return the 3 rows 8, 9 and 12.
More DBMS and SQL questions
- R(A, B) has 5000 tuples with V(R, B) = 100 distinct B values. S(B, C) has 3000 tuples with V(S, B) = 300 and V(S, C) = 60. Using the…
- R(A, B, C, D, E, F, G) has the functional dependencies AB -> C, C -> D, D -> E, E -> C, F -> G, BG -> A and AE -> F. How many candidate…
- R(A, B, C, D, E) has the functional dependencies A -> B, BC -> D, D -> E and E -> B. The decomposition R1(A, B), R2(B, C, D), R3(A, D, E) is
- Transactions are T1: R(A) W(A) R(B); T2: W(A) R(B) W(B); T3: R(B) W(A) (each executes its operations in the order shown). Of all possible…
- Basic timestamp ordering assigns timestamps TS(T1) < TS(T2) < TS(T3) < TS(T4) = 1, 2, 3, 4. For a data item Q, R(Q) is rejected if TS(T) <…
- An extendible hash index has bucket capacity 2 and uses the low-order bits of the integer key as the hash value (the directory starts with…