Hi,
I am working with a database with the following design. I read it is not a good practice to have closed loops in a database design, and i have more than one. But i cannot remember why. So not sure how this might affect me. Any examples how this could be dangerous?
Edit: went through my ebooks, found what i was reading was Beginning Database Design From Novice to Professional, publisher: APRESS.
they just warn against this, but give a vague reason why. No, we are not using triggers. Anyone has a clearer explanation?
Thanks
Excerpt, p.109:
A small company has employees who each work for one of a number of different small project groups. Each group and all its employees are housed in one particular room with larger rooms housing several groups.We may require information such as where each employee is located, a particular employee’s phone number, where to find a particular group, which employees work in each group, who is in each room, and so on. One possible data model is shown in Figure 5-7. Take a moment to understand the data model and the information it contains about the number of groups in a room and so on for this particular problem. The model has redundant information. Can you see what it is?
With respect to Example 5-3, if we regularly want to find an employee’s phone number, we might think that the top relationship in Figure 5-7 between Employee and Room would be a useful direct route. However, this same information is very easily available by an alternative route through Group. We can find the employee’s (one only) group and then find that group’s (one only) room. This is a very simple retrieval (it does not involve all the complications with dates that plagued the small hostel in Example 5-2). However, the extra relationship is not just unnecessary, it is dangerous. With two routes for the same information, we risk getting two different answers unless the data is very carefully maintained. Whenever an employee changes group or a group shifts rooms, there will be two relationship instances to update. Without very careful updating procedures, we could end up having that Jim is in Group A, which is in Room 12, while the other route may have Jim associated directly with Room 15. Redundant information is prone to inconsistencies and should always be removed.