Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PhixFlow's relationship diagrams are simplified entity-relationship diagrams (ERD).  An ERD is commonly used to show the relationships between database tables. If you are not familiar with ERDs for databases, the concepts are explained in this article: ER Diagram Tutorial in DBMS.  

Key concepts
Entity-Relationship DiagramPhixFlow Relationship DiagramExamples
A database table represents a thing or entity.

A stream represents a thing or entity.

Tip

Choose a stream name that reflects the entity it represents.


Entities:

  • Company
  • Employee
  • Department
  • Product
The column headers of a database table are the data attributes.

The stream attributes are the data attributes.

Employee attributes:

  • EmployeeID 
  • Name
  • Address
  • Phone
  • Department

A stream must include one unique attribute. This is usually an identifier, so has ID or UID in the name. The unique attribute is the primary key.

Primary Keys

  • Employee stream: EmployeeID
  • Department stream: DepartmentID
When the data from one stream's primary key also appears in a different stream, it is a foreign key.

Employee attributes:

  • EmployeeID (primary key)
  • Name
  • Address
  • Phone
  • Department = DepartmentID - foreign key

Department attributes

  • DepartmentID - primary key
  • Department Name
  • Purpose
  • Team members =  list of EmployeeID's = foreign key
Tables or attributes can have various relationships to each other

Attributes can have the following relationships

  • primary key → one to one → primary key
  • primary key → one to many → foreign key
  • foreign key → many to many → foreign key
Tip

Choose a relationship name that reflects the relationship


Relationships

  • one company → employs → many employee
  • one employee → works in → one department
  • one department → makes → many products


Relationships are usually expressed as an action (verb) that follows the left-right flow of the diagram. For example:

...