08 Data Modelling Pt1
08 Data Modelling Pt1
Feb 2011
Prepared by Guy Beauchamp
Group Projects & IT
Objectives
• To understand
– What is a data model … and what it is not!
– Why do data modelling
• To be able to
– Read a data model
– Build a data model
– Critically review a data model
What is a data model?
• Specification of the data that is required in order for
– The solution to meet it’s objectives
– Processes to be able to run
Designed Designed
Designed As As Designed
As As
Physical data Manual
Specs
Manipulate Procedures
Database System
Designs Manipulate Specs
Solution Specification
Data Model Components
Entity A real world thing or an interaction between 2 or more real world things.
Relationship How and why entities depend on each other (the relationship) and what that
relationship is (the cardinality of the relationship).
Attribute The atomic pieces of information that we need to know about entities.
Entity
“A real world thing or an interaction between 2 or more real world things.”
e.g.
Student, Premium, Business, Retail
There are dependency business rules between two entities – can be shown as:
Flight
Airport
Reading relationships
One Customer (entity) may (cardinality) purchase (relationship name) one
or more (cardinality) SALEs (entity)
Sale
Customer No Product No Date
10 101 21/2/2020
67 452 22/2/2020
Product
No Name Price
101 Flange £123.00
452 Blitwort £34.50
Primary Keys
•A special kind of attribute, set of attributes and/or relationships
•Is the way for the business to identify 1 unique instance of an entity
•Certain rules apply to a primary key:
•Must not be repeated within an entity
•Once assigned can never be updated (only deleted)
•Must be the way that the business uniquely identify an instance of an entity
Customer (entity)
No (attribute) Name (attribute)
10 Fred Bloggs (instance)
67 Freda Jones (instance)
Customer (entity)
No (attribute) Name (attribute)
10 Fred Bloggs (instance)
67 Freda Jones (instance)
Purchased
Sale Discussion:
Customer No Product No Date
What is the PK of Sale?
10 101 21/2/2020
67 452 22/2/2020 Do PKs need to be shown at the ‘FK’
end of a relationship?
Purchased via
Product
No Name Price
101 Flange £123.00
452 Blitwort £34.50
5 Data Modelling “No-No”s
How do we fix
this circular
relationship?
Process for producing a data model diagram
•identify candidate entities
•select a central candidate entity
•define the primary key
•work through the rest of the candidate entities
• consider whether it is in scope
• define the primary key
• define the relationship(s) between the candidate entity and all other
candidate entities on the diagram
• create description entities as needed
• fully express the cardinality of the relationship(s)
• name the relationship(s) as needed
•validate everything with the user
•review and refine.
Next step: Data definitions…
…covered in part 2 of this bite sized training
session
Minor Exercise
I own a florist’s shop called My Florist.
• Further resources…
• Feedback
• Thank-you!