NivaarExam PrepOfficial exam papers ↗

25-Comp-B3 Data Bases and File Systems · December 2015

Question 4 of 8

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

98-Comp-B3, Data Bases & File Systems — National Exams, December 2015. 3 hours, closed book, no calculators. Candidates were instructed to answer five questions: one of Questions 1/2, one of Questions 3/4, and three of Questions 5–8 — only those five are marked, and question 4 of note states all eight questions carry equal value (20 marks each). All 8 questions are answered below for completeness (this is a study resource covering the full syllabus).

Reference texts: Silberschatz, Korth & Sudarshan, Database System Concepts (7th ed.) — ER modelling, normal forms, and transactions/serializability; Ramakrishnan & Gehrke, Database Management Systems (3rd ed.) — B+-tree indexing, SQL, and relational algebra.

Question 4 (20 marks)

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. Members (unique member number, email, name, password, home address, phone) may be a buyer (has a shipping address), a seller (has a bank account/routing number), or both. Sellers list items (unique item number, title, description, starting bid, bid increment, start/end dates) under a fixed classification hierarchy (e.g. Class: Computer → Subclass: Hardware → Description: Modem). Buyers place bids (price, timestamp) on items; the highest bidder wins when the auction ends, and buyer/seller may each leave feedback (a 1–10 rating and a comment) about the other on the completed transaction.

Find. A complete ER model with entities, keys, relationship cardinalities/participation, and any constraint the diagram cannot capture.

Approach. Model Member as a superclass with an EER specialization into Buyer and Seller — overlapping, not disjoint, since "a member may be a buyer or a seller, or both." Model Category with a self-referencing (recursive) relationship, since "Class > Subclass > Description" is a hierarchy of arbitrary depth built from the SAME entity type, not three different entity types. Model Bid as a weak entity with TWO identifying owners, Buyer and Item, because a plain M:N relationship allows only one relationship instance per (Buyer, Item) pair, while a buyer may legitimately bid on the same item several times at different timestamps — Bid needs its own identity (partial key: bid time) precisely to allow that. The "highest bid wins" rule is a comparison ACROSS all of an item's bids, which is exactly the kind of constraint no ER diagram can express (see below).

Entities. Member (MemberNo key, Email, Name, Password, HomeAddress, Phone), specialized (overlapping, partial — a member need not be either) into Buyer (ShippingAddress) and Seller (BankAccountNo, RoutingNo). Category (CategoryName key) with a recursive SubcategoryOf relationship (1 parent : N children). Item (ItemNo key, Title, Description, StartingBid, BidIncrement, StartDate, EndDate). Bid (weak; partial key BidTime; attribute BidPrice). Transaction (TransactionID key).

Relationships. SubcategoryOf (recursive on Category, 1:N, partial — a top-level category has no parent). ClassifiedAs: Category (1) – Item (N, total — every item needs a leaf category). Lists: Seller (1) – Item (N, total on Item, partial on Seller). PlacedBy (identifying): Buyer (1) – Bid (N, total). For (identifying): Item (1) – Bid (N, total). Sells: Item (1) – Transaction (1, partial on Item — only items that actually sold get a transaction). Feedback: Transaction (N) – Member (M) — connected to the MEMBER superclass rather than to Buyer or Seller alone, since either party to a completed transaction may leave feedback ABOUT the other, and each transaction can carry up to two Feedback entries (buyer-about-seller, seller-about-buyer), each with its own Rating and Comment attributes.

CATEGORYMEMBERBUYERSELLERITEMBIDTRANSACTION1NSubcatOfOClassAs1NLists1NPlacedBy1NFor1NSells11FeedbackNM
Question 4 — cBay Online Auction ER diagram (Chen notation; O = overlapping specialization; double line = total participation; BID is a weak entity with two identifying owners (Buyer, Item); Feedback links each TRANSACTION back to the MEMBER superclass, since either the buyer or the seller may leave the review)
Check — assumptions
Bid is modelled as a multi-owner weak entity (identified jointly by Buyer, Item, and its own BidTime) — a documented EER extension for associative entities that need their own identity beyond a plain M:N relationship's attributes, used here because "buyers make bids" (plural) on the same item over time. Transaction is assumed to cover exactly one Item per auction closing (no multi-item lots); if cBay allowed bundled-item transactions, Sells would become 1:N (Transaction 1 – Item N) instead.

Constraint the ER diagram cannot capture. "The bidder with the highest bid price is declared the winner" requires COMPARING every Bid an item has received and selecting the maximum — an aggregate, cross-instance computation over an entire relationship set. ER cardinality and participation constraints only describe how many instances of one entity type can relate to another; they have no notation for "pick the extreme value among a set of related instances." This is exactly why "winner" is NOT drawn as its own attribute or relationship above: which Bid is the winning one is derived data (computable at query time from Bid.BidPrice grouped by Item), not a fact the schema needs to store or can constrain structurally. The Transaction entity captures the CONSEQUENCE of that computation (a sale occurred) without the ER diagram itself expressing the "highest wins" rule.

Final results — Question 4
ItemValue
EER specializationMember → {Buyer, Seller}, overlapping, partial
Weak entity / identifying relationshipsBid, owned jointly by Buyer (PlacedBy) and Item (For)
Recursive relationshipSubcategoryOf on Category (the Class/Subclass/Description hierarchy)
Constraint NOT expressible"Highest bid wins" — an aggregate MAX comparison across a relationship set, not a structural cardinality/participation constraint