Skip to content

CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Database Management

A bank's database has entities Customer and Account. One customer may hold many accounts, but each account belongs to exactly one customer. When this ER design is converted into relational tables, what is the standard way to implement the relationship?

The Customer primary key should be added as a foreign key in the Account table. In a one-to-many relationship the foreign key sits on the many side. A junction table is needed only for many-to-many relationships, and merging tables creates repeating groups.

  1. APlace the Customer primary key as a foreign key in the Account tableCorrect
  2. BPlace the Account primary key as a foreign key in the Customer table
  3. CCreate a separate junction table holding both primary keys as a composite key
  4. DMerge both entities into one table with repeating account columns

Explanation

A one-to-many relationship is implemented by putting the primary key of the 'one' side (Customer) as a foreign key in the 'many' side (Account). Placing the key on the Customer side would force repeating groups. A junction table is needed only for many-to-many relationships.

Did you get it right without looking?

One question tells you little. A timed set on Database Management shows your real accuracy, how long you take and where you lose marks.

More Database Management questions