Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Meaning of "Direct Relationship" in an ERD.

  1. Oct 10, 2015 #1

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Hi all, I am trying to understand the meaning of "Direct Relationship" between two entities belonging to an ERD, i.e., an entity-relation diagram associated with a Relational database. A Google search did not return anything helpful.
    Say, A,B are the entities in question. I assume this means that there should be an arrow joining them, i.e., A,B are incident with each other. Or does it mean that there is a path joining A with B?
     
  2. jcsd
  3. Oct 10, 2015 #2

    jim mcnamara

    User Avatar

    Staff: Mentor

    A direct relationship simply means the object or datum exists in two contexts and both have to there to make the relationship function.

    A foreign key is an example. The parent table has a unique key for each row, Dog_breed, like basset hound or collie. The"child" table has an instance of a collie named fred. Since this is a foreign key relation ship, the Dog_breed in the child table is "collie" which references the parent, and the dog's name "Fido", which is the local key.

    So these rules for Dog_breed apply:
    It is never NULL in either table.
    Any entry in the child table can only have Dog_breed values found in the parent.
    The parent may have only one entry for each Dog_breed, the child may be a repeating table with lots of collie.

    Good design dictates that each child row in a repeating table has a unique "key", it may just be a combination of breed, name, and owner, or some kind of non-repeating sequence. Or a combination of all four fields. That way you can distinguish rows based on some fixed data attribute rather than the physical location of the row - which can change, e.g. via a table reorg.
     
  4. Oct 10, 2015 #3

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Thanks, Jim, I guess this is then equivalent, given tables A,B,C , that A,C are related in the primary key PK(A) appears as FK(C)?
     
  5. Oct 11, 2015 #4

    jim mcnamara

    User Avatar

    Staff: Mentor

    That is it, you have it. Note - you make the rules when creating the database. Poor rules == poor design.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Meaning of "Direct Relationship" in an ERD.
  1. This error means? (Replies: 1)

Loading...