Hamish Burke | 2025-03-12
Related to: #databases
Entity-Relationship Data model
- related to q4 in assignment
Entities
- Basic objects that can be identified in the target of the database
- Eg:
- STUDENT
Attributes
- Properties that describe entities
- Eg entity STUDENT has
{StudID,Name,DoB,Email}
, primary key{StudID}
Relationships
- Associations between entities, or objects that are derived from entities
- Same as Relation schema in Relational Data Model
- Have entities as their Components
- Also have attributes as properties that describe them
- Drawing
- Entity is rectangle
- Relationship types are diamond
- Arrow going from relationship to entity, means that entity is a component of that relationship
- Arrow with circle on it means its a key component
- Eg Relationship type
ENROL
- With component set
STUDENT,COURSE
- Attribute set
CalYear,Semester,Points
- Primary key
STUDENT,COURSE,CalYear
- With component set
Recursive Relationship types and roles
- Contains the same entity type more than once as a component
- Eg model a relationship between a child and a parent
- Two components,
CHILD
andPARENT
- Two components,
- Entity type and relationship types together form a Entity-Relationship (ER) schema
ER Schema
- A finite set
of entity and relationship types - That for every relationship type
in all its components belong to , too
- That for every relationship type
- Instance of schema =