Lossless-join decomposition 2026-10-31
A decomposition of a relational schema whose component relational projections always reconstruct the original database relation by natural join, without extra database tuples.
Solutions to all three questions of the examination dated 3 June 2015. The cover permits answers to two questions.[ref]
Use classical relational algebra with set semantics. Write for the paper's
Car, Sales, Customer and Salesperson database relations. A natural join between and matches serialnumber; joins involving a salesperson explicitly match salespersonid to empid. Identifiers, rather than names, distinguish customers and salespeople. The calculations use the ordinary non-null relational model; the SQL aggregate below also explains its empty-input behavior. Past exam of the computer science course of the University of Oxford 2015 Databases 1 a ii Solution 2026-10-31
Construct the required models and the actual customer–model purchases using relational projection and a natural join:The Cartesian product lists every obligation: every customer paired with every model present in
Car. The relational difference consists of unfulfilled obligations. Remove the customer identifiers occurring in this database relation and only then recover names:This is an explicit relational division construction with all customers as the candidate universe. If there are no models, there are no missing obligations, so every customer qualifies. A version starting solely from customers occurring in would incorrectly omit customers with no purchases in that empty-model case.The quantified object here is the
model database attribute, so two makes sharing a model value contribute one required value. If a different application identified a model by the pair (make, model), both the required and purchased relational projections would use that pair. Also, Car contains unsold cars: a model available only in unsold inventory is still a required model, and then nobody qualifies. Testing identifiers before names prevents different customers with the same name from pooling their purchases. Past exam of the computer science course of the University of Oxford 2015 Databases 1 a i Solution 2026-10-31
First use relational selection to keep the Saab cars, then a natural join to find their sales, and finally a relational join to identify the corresponding salespeople. A relational projection givesThe foreign keys ensure that every sale has the referenced car and salesperson. Several qualifying sales by the same person produce just one occurrence of their name under set semantics. Two distinct people with the same name also yield that name only once: this is the requested relational projection onto names.
Relational join 2026-10-31
Combines database tuples satisfying a matching condition. A natural join uses equality of all shared database attribute names.