The best solution is a triple or binary relationship

I am trying to ask a question for one of my courses and it revolves around which relationship is the best solution - binary or triple.

Link examples

enter image description here

So, this is a video store with three objects - Video, Member and Casual.

Members and Casuals can borrow videos and record the date on which it was borrowed.

Would a triple ratio be the most appropriate solution, since there is no distinction between penis and random video borrowing?

0


source to share


1 answer


What triple (3-entity) bond do you consider the Burroughs diamond? This is between the member client, video, casual client, and credit date. "HOSTNIK borrowed VIDEO from CASUAL on LOANDATE"? "VIDEO has a CASUAL punching MEMBER born on LOANDATE"? "MEMBER borrowed VIDEO for LOANDATE and CASUAL is null or CASUAL borrowed VIDEO for LOANDATE and MEMBER is NULL?" The same is true for each of the left and right Born binary relations.

(I use a predicate (statement pattern parameterized by columns) to express the "value" of a table. When you include a row, you get a clause (a statement). Each table (a base or query result) contains rows that turn its predicate into a true clause. Relational operators (union, union, etc.) are chosen to alternate expression and evaluate predicate expressions using logical nonterminals (AND, OR, etc.) of the desired query predicate.)

The chart has a diamond. It must maintain the relationship between MEMBERS, VIDEOS and CASUAL objects plus LOANDATE. Seems hard to come up with a sensible Trinity Borrows, doesn't it? If you cannot think of one thing, then this is not a diagram describing your situations. I cannot think of one that is limited to threes of these three kinds of entities. Whereas binaries make sense easily.

PS My only caveat is that the third option I gave is typical relationships as embodied in database tables. But this is not just about model objects. It also includes a "zero" value. If we believe that the relationship is among the values ​​that identify entities or not, then we can have this relationship using null.



Borrows:
    "MEMBER borrowed VIDEO due on LOANDATE and CASUAL is null
    or CASUAL borrowed VIDEO due on LOANDATE and MEMBER is null"
MEMBER  VIDEO   CASUAL   LOANDATE
=================================
  1       a      null    1/1/2000
  2       b      null    1/2/2000
 null     c    1234567   2/3/2000

      

I don't know what your teachers intended. But I suspect they didn't expect you to include null.

PPS Re "Would a binary link have a problem where the same VIDEO could occupy the same video?" I'm not sure what you think. But the relationship just contains strings that make a true statement from its statement template. He describes the situation. This cannot lead to a certain situation. "Business rules" (and physics!) Limit situations that arise. But you need to write down enough information to run your business. And the DBMS can be told about the impossible states of the database so that it can reject them.

0


source







All Articles