25-Comp-B3 Data Bases and File Systems · December 2015
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.
Given. CarSale(CarID, OptionType, OptionListPrice, SaleDate, OptionDiscountedPrice) with F = { CarID→SaleDate, OptionType→OptionListPrice, CarID,OptionType→OptionDiscountedPrice }, decomposed into R1=CarSale(CarID,SaleDate), R2=Options(OptionType,OptionListPrice), R3=CarOptions(CarID,OptionType,OptionDiscountedPrice).
Find. (a) the definition of a functional dependency; (b) whether {R1,R2,R3} is a lossless-join decomposition; (c) whether it is dependency-preserving.
Approach. (b) uses the general CHASE (tableau) test, which handles a decomposition into any number of pieces (the textbook's common-attribute shortcut only covers exactly two pieces): build one tableau row per relation with distinguished symbols for its own attributes and unique symbols elsewhere, then repeatedly equate cells forced equal by each FD until nothing changes — the decomposition is lossless exactly when some row ends up entirely distinguished. (c) checks each ORIGINAL FD's full attribute set against the three pieces directly.
| Row | CarID | OptionType | OptionListPrice | SaleDate | OptionDiscountedPrice |
|---|---|---|---|---|---|
| R1 (CarID,SaleDate) | a1 | b1,2 | b1,3 | a4 | b1,5 |
| R2 (OptionType,OptionListPrice) | b2,1 | a2 | a3 | b2,4 | b2,5 |
| R3 (CarID,OptionType,OptionDiscountedPrice) | a1 | a2 | b3,3 | b3,4 | a5 |
A row of all-distinguished symbols is exactly the chase's termination condition for a LOSSLESS-JOIN decomposition (that row certifies the original relation is always recoverable by natural-joining R1, R2, R3 back together): the decomposition IS lossless. This matches the intuitive reason too — R3 already contains BOTH halves of the whole relation's only candidate key {CarID, OptionType} (since {CarID,OptionType}+ = all 5 attributes, using all three given FDs, and no proper subset of it determines everything), so joining R1 and R2 back onto R3 can only ever re-attach exactly the SaleDate and OptionListPrice values that belong to each row, never spurious combinations.
Part (c) — dependency preservation. A decomposition preserves F if the UNION of each Fi (F projected onto relation Ri) still implies every original dependency, i.e. F ⊆ (F1∪F2∪F3)+. Here the check is immediate without computing any closure at all: each of the three given FDs has BOTH its left- and right-hand attributes wholly contained within a SINGLE decomposed relation — CarID→SaleDate sits entirely inside R1={CarID,SaleDate}; OptionType→OptionListPrice sits entirely inside R2={OptionType,OptionListPrice}; CarID,OptionType→OptionDiscountedPrice sits entirely inside R3={CarID,OptionType,OptionDiscountedPrice}. Since every original FD already appears, verbatim, as a dependency projected onto one of the three pieces, F1∪F2∪F3 literally CONTAINS F (not merely implies it). Yes, the decomposition is dependency-preserving — and it is the strongest possible case, since no cross-relation reasoning (join, then re-derive) is ever needed to recover any of the three original rules.
| Part | Result |
|---|---|
| (b) Lossless-join? | Yes — chase produces an all-distinguished row (R3) |
| (c) Dependency-preserving? | Yes — every FD's attributes lie wholly within one decomposed relation |