Tita
Tita

Reputation: 113

Can a weak entity have more than one strong entity using the same relationship?

I am having trouble finding a similar example to what I'm thinking, which is why I'm having doubts that it's correct concerning ER diagrams and weak entity relationships with their strong entities.

This thought occurred while studying Question 6.1 from Silverschatz's Database System Concepts the solution of which is provided here. In here, they make 'payments' a weak entity to 'policy' with the 'payment' relationship which is one to many with total participation on both parts.

I was wondering weather we could add another branch on from 'car' or from 'customer' to the 'payment' relationship with total participation so that whenever a payment is made for a car under a certain policy that covers it the key for said payment is (customer_id, policy_id, payment_no) or (car_id, policy_id, payment_no).

The way I understand it, this would allow us to see which car the payment was made for. To further demonstrate my thoughts and understanding suppose that we have 5 cars each for one out of 5 customers that are covered by 2 different policies that the company offers and make a premium payment each month that they are insured. Then with the current Database that the solution in the link offers, I understand that we would just see for each of the two different policies the different payments that were made for them, but not knowing which car they were specifically for and the primary key of 'payments' being (policy_id, payment_no). If we add the total participation on the 'payment' relationship on the car's part however, the participation relationship would bring to the payment the primary key I mentioned above.

Considering that in a real life scenario the payment_no would correspond to a certain customer who pays it for one or more of their cars, wouldn't it be more useful to connect that information to the customer/car to the actual payment they made? This maintains the one-to-many relationship for the weak entity as well.

If each policy_id is unique to each car then I can see how this thought process falls flat, but if each policy_id just refers to the offered policies that the cars can be insured under I think this makes more sense...

My question is similar to this one I believe, I'm just trying to make sure that I understand this through an example and that the summation of unique keys they're referring to is the same as I provided above.

Extra question on the diagram: In the 'participated' relationship, shouldn't the total participation be on the 'accident' side instead of the 'car' and a single lined arrow be pointed towards 'car'? Since not all cars necessarily have been in an accident, but each accident should include one car only?

Upvotes: 1

Views: 1077

Answers (1)

reaanb
reaanb

Reputation: 10064

According to Peter Chen's original paper on the entity-relationship model, "any kind of relationship may be used to identify entities" and "If relationships are used for identifying the entities, we shall call it a weak entity relation. If relationships are not used for identifying the entities, we shall call it a regular entity relation." So it is possible to do what you have in mind. Note the use of "regular" as opposed to "strong" when referring to an entity relation identified by its own attributes.

Practically I don't agree with linking payments to cars or customers. A policy can cover more than one car, and customers generally pay a premium as a single transaction, not per car. Customers can't pay half a premium, they have to pay the whole premium for the insurance policy to be valid. Splitting a payment between the insured cars would also be difficult if there were any policy-level additional charges or discounts. Also think about your proposed changes if unique receipt numbers were added to the model.

Cars can be owned by multiple owners, and payments can be made by either owner, or even from a joint account or by someone who is not linked to the car. So again, I don't see the sense in it.

Regarding the participated relationship, the document you linked says "Note that the participation of accident in the relationship participated is not total, since it is possible that there is an accident report where the participating car is unknown."

Upvotes: 2

Related Questions