Kieran Herley
Summary The database design process and the role of ER modelling in same. Basic constituents of ER diagrams: entities, relationships and attributes.
While designing database it’s handy to have notation to “sketch” schema s Two common diagrammatic notations: x x s UML diagrams (Universal Modelling Language) ER diagrams (Entity Relationship) → cs1106 choice
Captures the information requirements of our database: what data it con and how these interrelate
[TOC]
ER Di
Database Development Process
1. Requirements analysis: figure out what is required of our database 2. Design: s s s s
Entities
Develop an ER diagram to sketch a design that meets these requirements “Translate” ER diagram into detailed DB schema
An entity is a “thing” e.g. a person An entity set is a collection of similar entities e.g. a collection of persons s An attribute is some property of the entities in an entity set e.g. the dat birth of each person
3. Implementation: Generate SQL code for design
[TOC]
ER Diagrams – 3 / 18
[TOC]
ER Di
Entities in ER Diagrams s Relationships
Relationship captures a connection between two or more entity sets s Example: s Will represent entity sets using rectangles, attributes as ovals
x x
Entity sets: students, modules Relationships: s s
is taking: Alice is taking cs1106 loves: Bob loves cs1109
s
Entity set eaters has attributes name and address; each entity with this set has a value for each attribute
[TOC]
ER Diagrams – 5 / 18
[TOC]
ER Di
Relationships in ER Diagrams s A More Complex Example
Key:
s s s
We use diamonds to depict relationships
Restaurants serve some foods Eaters like some foods Eaters frequent some restaur
s
Connect diamond to entity sets involved in relationship
[TOC]
ER Diagrams – 7 / 18
[TOC]
ER Di
Relationship Sets
The “value” of an entity set is the set of entities that