Meaning of "Direct Relationship" in an ERD.

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    Relationship
Click For Summary

Discussion Overview

The discussion revolves around the concept of "Direct Relationship" in the context of Entity-Relationship Diagrams (ERDs) related to relational databases. Participants explore the implications of such relationships, particularly focusing on how entities are connected and the role of foreign keys.

Discussion Character

  • Conceptual clarification
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant seeks clarification on whether a "Direct Relationship" means an arrow connecting two entities or simply a path between them.
  • Another participant explains that a direct relationship indicates that an object exists in two contexts, requiring both to function, using foreign keys as an example.
  • The example provided involves a parent table with a unique key and a child table referencing this key, emphasizing rules regarding NULL values and uniqueness in the child table.
  • A later reply confirms the understanding that a primary key in one table can appear as a foreign key in another, reinforcing the relationship between the entities.
  • There is a note on the importance of establishing good design rules when creating a database to avoid poor design outcomes.

Areas of Agreement / Disagreement

Participants generally agree on the concept of direct relationships involving foreign keys, but the initial definition of "Direct Relationship" remains somewhat contested, with different interpretations presented.

Contextual Notes

The discussion does not resolve the ambiguity surrounding the term "Direct Relationship," and assumptions about the definitions of relationships in ERDs are not fully explored.

Who May Find This Useful

Individuals interested in database design, particularly those studying or working with Entity-Relationship Diagrams and relational databases.

WWGD
Science Advisor
Homework Helper
Messages
7,801
Reaction score
13,105
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?
 
Technology 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

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 41 ·
2
Replies
41
Views
5K
  • · Replies 62 ·
3
Replies
62
Views
5K
  • · Replies 11 ·
Replies
11
Views
6K
Replies
12
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K