02 ER
Database Paradigms¶
- Relational (tables)
- Hierarchical (like tree)
- Network (interconnected)
- Object Oriented
- Object-Relational
- ER (Entity-Relationship)
- NoSQL
ER Model¶
A database can be modelled as
- entity set
- relationship sets
Terms¶
Term | Meaning | Example |
---|---|---|
Entity | unique object | specific person, company |
Entity Set | set of entities | |
Attributes | properties/features of an entity/relationship | name, age |
Composite Attributes | sub-attributes | first name, last name |
Relationship | association among several entites | |
Relationship Sets | set of relationships | |
Degree of Relationship Set | no of entity sets that participate in a relationship set | |
Mapping Cardinalities | Type of mapping | One-One One-Many Many-One Many-Many |
ER Diagram¶
Symbols¶
Shape | Meaning |
---|---|
Rectangle | Entity Set |
Double Rectangle | Weak Entity Set entity without a primary key |
Diamond | Relationship Set |
Double Diamond | Weak Relationship Set relation connecting a weak entity with something else |
Dashed ellipse | derived attribute |
Double ellipse | multi-valued attribute |
Underline | primary key attribute |
Triangle | ‘is-a’ relation |
Lines | - link attribute to entity set - link entity set to relationship set |
\(\to\) | one |
\(-\) | many |
IDK¶
Super key is any key that can uniquely identify a record
We don’t have to include foreign key for a relation
it is implied that the primary keys of the connected entities are the foreign keys for the relation
Disjoint ‘is-a’¶
can be either this or that