ITPEC FE Subject A April 2024 Question 20

Topic: DatabasesAlso asked in Spring 2020

From the figure below, which of the following is an appropriate set of attributes for the “CatalogProduct” class table?

CatalogCatalogIDSeasonYearDescriptionEffectiveDateEndDateCatalogProductPriceSpecialPriceProductItemProductIDVendorGenderDescription⋮10..*0..*1

Explanation

CatalogID, ProductID, Price, SpecialPrice — CatalogProduct links a catalog to a product, so its table needs both foreign keys plus its own attributes.

Catalog to CatalogProduct is 1 to 0..many, and ProductItem to CatalogProduct is 1 to 0..many. Each CatalogProduct therefore belongs to exactly one catalog and one product: it resolves the many-to-many relationship between catalogs and products.

  • •CatalogID refers to Catalog
  • •ProductID refers to ProductItem
  • •Together they identify a row (a composite primary key), and Price and SpecialPrice are the prices of that product in that catalog

Answer (b)

Why not others:

  • •(a) — has no ProductID, so a row cannot say which product it prices
  • •(c) — has no key at all, so a row cannot be tied to either a catalog or a product
  • •(d) — has no CatalogID, so the same product could not have different prices in different catalogs

Key rule: A class on the many side of two one-to-many associations becomes a table that carries the key of each one side as a foreign key, and the pair usually forms its primary key.

Databases · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.