CS FundamentalsHardAmazon/Flipkart SQL round · GATE CS
Table P(x) rows: (1), (2), (2), (3), (NULL). Table Q(x) rows: (2), (3), (3), (NULL), (4). What does this query return?
Table P(x) rows: (1), (2), (2), (3), (NULL).
Table Q(x) rows: (2), (3), (3), (NULL), (4).
What does this query return?
SELECT COUNT(*) FROM P WHERE x NOT IN (SELECT x FROM Q);
- A. 0
- B. 2
- C. 3
- D. 1
Correct answer: A. 0
Q contains a NULL, so for every P value x NOT IN Q is either FALSE (x found) or UNKNOWN (x compared with NULL). No row is TRUE, so the count is 0.
More DBMS and SQL questions
- On R(A, B, C, D, E), F = {AE → D, A → CD, B → A} and G = {B → ACD, A → CD}. Which statement is correct? ("F covers G" means every FD of G…
- R(A, B, C, D, E, F) has functional dependencies BF → A, D → E, AC → F, BD → A, A → B. Which of these attribute sets is NOT a superkey of R?
- R(A, B, C, D, E) has functional dependencies A → BCE, C → AD, B → DE. What is the closure {B}⁺?
- R(A, B) = {(a1, b1), (a1, b2), (a2, b2), (a2, b3), (a3, b1), (a3, b2), (a4, b1), (a4, b2), (a4, b3)} and S(B) = {b1, b3}. What is R ÷ S?
- What is the maximum possible number of candidate keys a relation with 6 attributes can have (over all FD sets)?
- R(A, B, C, D, E) with functional dependencies BC → A, D → B, A → D is decomposed into R1(A, C, E), R2(A, B, D). Which statement is correct?