CS FundamentalsVery hardGATE
R(City, Street, Zip) has FDs City,Street → Zip and Zip → City, with candidate keys {City,Street} and {Street,Zip}. Decomposing into R1(Zip, City) and R2(Zip, Street) removes the BCNF violation (Zip → City, since Zip alone isn't a superkey). Is this specific decomposition lossless, and is it dependency-preserving?
- A. Neither lossless nor dependency-preserving
- B. Lossless (Zip is a key of R1), but NOT dependency-preserving (City,Street → Zip can no longer be checked without joining R1 and R2 back together)
- C. Lossless and fully dependency-preserving
- D. Not lossless, but dependency-preserving
Correct answer: B. Lossless (Zip is a key of R1), but NOT dependency-preserving (City,Street → Zip can no longer be checked without joining R1 and R2 back together)
The common attribute of R1(Zip,City) and R2(Zip,Street) is Zip, and Zip → City makes Zip a key of R1, satisfying the lossless-join test. But City,Street → Zip no longer lives inside either piece alone — Street is in R2, City is in R1 — so verifying it requires rejoining R1 and R2, meaning this correct, BCNF-achieving decomposition is NOT dependency-preserving.
More DBMS and SQL questions
- A relation R(City, Street, Zip) has FDs City, Street → Zip and Zip → City (candidate keys: {City, Street} and {Street, Zip}). Why is this…
- The 3NF synthesis algorithm (based on a minimal cover of functional dependencies) is guaranteed to always produce a decomposition that is…
- Table Products(pid, pname, category, price, stock) rows: (1, 'Pen', 'Stationery', 10, 100), (2, 'Notebook', 'Stationery', 50, 0), (3…
- A database stores timestamps in UTC and converts to local time only at the application layer. A query does WHERE createdat BETWEEN…
- A column price NUMERIC (arbitrary precision decimal) is compared against a literal using price = 19.99. Why is this generally SAFE from…
- A relation R(A, B, C, D) has candidate key ABD (the ONLY candidate key) and FD AB → C (C is non-prime). Which normal form violation does…