CS FundamentalsHardGATE CS (PYQ pattern)
R(A, B) has 100 tuples; R.B is a foreign key to S(B), which is S's primary key, but R.B allows NULL and 10 tuples of R have B = NULL. S has 50 tuples, of which exactly 30 are referenced by some R tuple. How many tuples are in R join S (on B) and in R full outer join S?
- A. 100 and 120
- B. 90 and 120
- C. 90 and 110
- D. 100 and 150
Correct answer: B. 90 and 120
Every non-NULL R.B matches exactly one S tuple: 90 joined tuples. The full outer join adds the 10 R tuples with NULL B (they match nothing) and the 20 unreferenced S tuples: 90 + 10 + 20 = 120. Treating the FK as guaranteeing a match for all 100 rows gives 100.
More DBMS and SQL questions
- Three transactions each run x = x + 10 as an unprotected read followed by a write of (value read + 10), on a shared x that starts at 0…
- R(A, B, C, D, E, F) has the functional dependencies B → E, F → A, BC → F, AF → D, C → B. What is the highest normal form of R (1NF, 2NF…
- R(A, B, C, D, E) has the functional dependencies D → C, DC → B, A → B, AC → E, C → A, E → C, D → E. How many of the listed dependencies…
- R(A, B, C, D, E, F) has the functional dependencies A -> B, DB -> F, FB -> C, A -> C, A -> D, EF -> B. An attribute set X is closed if X+…
- R(A, B, C, D, E, F) has the functional dependencies AF → E, D → B, BF → D, ED → C, C → F. How many attributes belong to EVERY candidate…
- R(A, B, C, D, E) has the functional dependencies BD → A, B → E, AC → B, B → D, A → C. Which statement is correct?