CS FundamentalsHardProduct-company interview pattern
R(A, B, C, D) has FDs A → B and C → D. It is decomposed into R1(A, B), R2(C, D) and R3(A, C). Which statement is correct?
- A. It is lossy, because R1 and R2 share no attribute
- B. The decomposition is lossless and dependency-preserving
- C. It is lossless but not dependency-preserving
- D. It is dependency-preserving but lossy
Correct answer: B. The decomposition is lossless and dependency-preserving
AC is the key of R (AC⁺ = ABCD), and R3 contains it. Joining R3 with R1 on A (A → B, A is a key of R1) and then with R2 on C (C → D) is lossless at each step. A → B lives in R1 and C → D in R2, so dependencies are preserved. R1 and R2 need not share attributes because R3 links them.
More DBMS and SQL questions
- R(A, B, C, D) has exactly two candidate keys: A and BC. How many superkeys does R have?
- You need the customers who have placed no orders. Orders.cust may contain NULL values. Which query is correct in that case?
- Table Proj(pid, lead, dept, budget, parent) rows: (1, 'Uma', 'R&D', 900, NULL), (2, 'Vik', 'R&D', 400, 1), (3, 'Uma', 'Ops', NULL, 1), (4…
- Table Proj(pid, lead, dept, budget, parent) rows: (1, 'Uma', 'R&D', 900, NULL), (2, 'Vik', 'R&D', 400, 1), (3, 'Uma', 'Ops', NULL, 1), (4…
- Table Proj(pid, lead, dept, budget, parent) rows: (1, 'Uma', 'R&D', 900, NULL), (2, 'Vik', 'R&D', 400, 1), (3, 'Uma', 'Ops', NULL, 1), (4…
- Table Proj(pid, lead, dept, budget, parent) rows: (1, 'Uma', 'R&D', 900, NULL), (2, 'Vik', 'R&D', 400, 1), (3, 'Uma', 'Ops', NULL, 1), (4…