Sample bartleby Q&A Solution
You ask questions, our tutors answer
Browse
Question

Construct an E-R diagram for a car insurance company having customers each of which owns one or more cars. Each car has a number of recorded accidents associated with it?

Expert Answer

We start by identifying the entities and entity sets.

  • Each customer, car and accident is an entity as it can be uniquely identified. So we make entity set (set of unique entities of the same type) as Customer, Car and Accident.
  • Next, we identify the attributes of each entity.
  • Customer entity could have attributes such as name, address, social security number, driving license number. Car entity would have the attributes such as chassis number, model, manufacturer, date of registration, color, weight. Accident entity could have attributes such as incident serial number, incident date, incident time, incident location, incident description, incident reporting officer. Of course it is possible to identify other relevant attributes for the entities. Each entity in an entity set will have the same set of attributes.

The entity sets are the rectangles and the attributes are the oval shapes.

We identify the primary key for each entity set:

  • Since each customer would have a unique social security number, license number, these are candidate keys as these are minimal sized keys that uniquely identify the entities in the entity set. Let’s choose (arbitrarily at the moment) social security number as the primary key for the Customer entity set.
  • Since each car can be uniquely identified by its registration number or chassis number either could be primary key. We choose chassis number.
  • Each Accident would be uniquely identified by the Incident serial number generated when the incident reporting officer generates the report on the spot. So Incident Serial Number is the primary key. There could have been other attributes which together could have identified uniquely an accident, for example the following four attributes - incident date, incident time, incident location, car registration number. However, it is good design to choose a smaller sized key due a variety of data modeling design considerations.

The primary key attributes are underlined in the diagram.

We identify the relationships and relationship sets.

The following relationships exist:

  • Each customer has one or more cars.
  • Each accident is uniquely related with each car. Each car can be involved in one or more accidents.

The above analysis gives rise to the following relationship sets:

  • “Owns” – Customer “owns” Car. It is a one-to-many relationship.
  • “Involved in” – Car “involved in” Accident. It is a one-to-many relationship.

The one-to-many relationship is indicated by crow’s feet notation. The many side in the relationship is indicated by the fork end (crow’s feet).