Meaning of "Direct Relationship" in an ERD.

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    Relationship
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
3 replies · 2K views
Science Advisor
Homework Helper
Messages
7,908
Reaction score
13,226
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?
 
Physics news on Phys.org
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.
 
  • Like
Likes   Reactions: WWGD
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)?
 
That is it, you have it. Note - you make the rules when creating the database. Poor rules == poor design.
 
  • Like
Likes   Reactions: WWGD