Forum Moderators: phranque
This is the question:
The company would like to store information of person and car that are insured by them. Each
person can own one or more cars. A car can only be owned by one owner, not more than one. A
person has details of driver license number, full name and address. Driver license number is
uniquely identified for each person. A car has details of license (plate number), model and year.
Each car is identified by license number.
Each car has associated with its zero to any number of recorded accidents. Accident has attributes
of report number, location and date. The damage amount must be recorded in the event of each
accident. The car owner might no be the driver of the car involved in the accident. It could be
someone else.
And my questions are:
1. What is the cardinality between car and accidents?
2. Where should I place the damage amount? is it attribute or not?
3. What is the cardinality between accident and person?
1. Optional one to many:
car 0..1 <-> * accidents
If you're only recording the driver of the insured's vehicle at the time of the accident, it would be
accident 0..1 <-> 1 person.
If you record both drivers, it would be
accident 0..1 <-> 2 person, though you'd probably want to annotate that relationship to note which person was driving the insured's car.
If you record all parties involved in the accident, or all parties in the insured's car, or you want to be able to record all drivers in nasty 3+ vehicle accidents, it would be
accident 0..1 <-> 1,* person.
If you want to be able to express "this car suffered $1,000 of damage in this accident", then an attribute of the relationship would be better. You'd also be able to model the (hopefully rare) corner case when one insured customer's car smashes into another insured customer's car...
If you find yourself doing modelling more often or are enjoying it, may I suggest "Data Modelling for Information Professionals" by Bob Schmidt. It's a quick and engaging read. It's not a programming book as such- it's targetted at anyone who thinks critically about the structure of information.