Tuesday, January 28, 2020

Entity Relationship Diagram

ERD
 - Entity Relationship Diagram
 -  is a type of structural diagram for use in database design. An ERD contains different symbols and connectors that visualize two important information: The major entities within the system scope, and the inter-relationships among these entities.

Entity / Entities
 - tables
 - is a definable thing or concept within a system, such as a person/role (e.g. Student), object (e.g. Invoice), concept (e.g. Profile) or event (e.g. Transaction) (note: In ERD, the term "entity" is often used instead of "table", but they are the same). When determining entities, think of them as nouns.
 - symbol is a rectangle

Weak Entities
 - tables that are dependent to other tables
 - symbol is double lined rectangle

Attributes
 - columns
 - is a property or characteristic of the entity that holds it
 - symbol is oval/elliipse

Types of Attributes
 - Derived ex. Age from Birthday
- symbol is dashed ellipse
 - Multi-valued ex. tags in a tweet - double line
- symbol is double ellipse
 - Composite ex. Name from lastName + firstName

Relationship
 - A relationship between two entities signifies that the two entities are associated with each other somehow

Cardinality
 - defines the possible number of occurrences in one entity which is associated with the number of occurrences in another

One-to-One Cardinality
 - is mostly used to split an entity in two to provide information concisely and make it more understandable ex. user and userProfile

One-to-Many Cardinality
 - A one-to-many relationship refers to the relationship between two entities X and Y in which an instance of X may be linked to many instances of Y, but an instance of Y is linked to only one instance of X

Many-to-Many Cardinality
 - A many-to-many relationship refers to the relationship between two entities X and Y in which X may be linked to many instances of Y and vice versa

Cardinality Symbols:



More Readings:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm





No comments:

Post a Comment