Suppose we have a relational table - [ X | A | B | ... ] where A and B are attributes of X.
Two common confusions:
(1) First, we can say that there IS a relationship between X and A. Since we observe that for each X there is only one A (1NF), but for each A there could be many Xs, we may be led to say there is a one‑to‑many relationship between X and A. However, that relationship is actually many X to one A, thus many to one, not one to many, as stated. When you say one to many (between X and A), I must apply them respectively, otherwise, confusion results from the ambiguity and inconsistency. So the relationship is Many to One between X and A, respectively.
(2) We observe that for each value of A there could be multiple different values of B in the table of X and vice versa. Does that mean there is a many‑to‑many relationship between A and B? Any discussion of oneness or manyness must presume there is a relationship. When you say there is a M:N relationship between A and B, then I must be able to list all the valid pair wise associations as in a table with two columns. And being M:N the same value of A can appear in multiple rows and the same value of B can appear multiple times. Of course the exact same values of A and B on a single row could never appear more than once since it would be the same instance of the relationship. Now for any given X, there is a value for A and a value for B. Would that particular value of A be the one that is related to that value of B? NO. Furthermore, could there be the same pair of A and B values appearing on multiple rows in X? YES. So the juxtaposition of A and B in X does not represent a relationship between A and B. It is spurious. IF there is a relationship between A and B, it must be represented in another table, and could be 1:1, 1:M, M:1 or M:N. But since we said that we know everything about X, A, and B and it is represented in the diagram, then there must not be a relationship between A and B. Again, you can look at the table of X and see that there are multiple different values of A appearing beside the same value of B and vice versa. However, that in no way means there is a relationship between A and B represented in the table of X.
No comments:
Post a Comment
Comments to any post are always welcome. I thrive on challenges and it will be more interesting for you.