Top Banner
Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions
19

Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Jan 13, 2016

Download

Documents

Pamela Lane
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Bite sized training sessions:Data Modelling – Part 2 of 2

Data Definitions

Page 2: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

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

Page 3: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

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

• A data model comprises:– A diagram showing the required data dependencies– A set of data definitions required for each attribute on the

diagram

• Also referred to as:– Logical Data Model (LDM)– Entity Model– Entity Relationship Diagram (ERD)– Data Dictionary– Object Model – Class Diagram– Data Structure– …etc!

Page 4: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

What a data model is not

• A physical design for storing data

• A database design• Database table definitions• Object specification

Page 5: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

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.

Page 6: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Attributes

No (attribute) Name (attribute)  

10 Fred Bloggs (instance)

67 Freda Jones (instance)

Customer (entity)

Customer No Product No Date

10 101 21/2/2020

67 452 22/2/2020

Sale

No Name Price

101 Flange £123.00

452 Blitwort £34.50

Product

“The atomic pieces of information that we need to know about entities”

Page 7: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

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

No (attribute) Name (attribute)  

10 Fred Bloggs (instance)

67 Freda Jones (instance)

Customer (entity)

Page 8: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Primary Keys are the navigation method for relationships

Purchases

Purchased via

No (attribute) Name (attribute)  

10 Fred Bloggs (instance)

67 Freda Jones (instance)

Customer (entity)

Customer No Product No Date

10 101 21/2/2020

67 452 22/2/2020

Sale

No Name Price

101 Flange £123.00

452 Blitwort £34.50

Product

Page 9: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

5 Data Modelling “No-No”s

1. No repeating attributes on entitiesE.g. On a Customer entity “1st child name”, “2nd child name”…

2. No attributes on entities that do not depend on the primary keyE.g. On Customer entity “order date”

The following should have been addressed via entity relationship diagram:

3. No “Many to Many”s between entities4. No “one to one”s between entities (usually)5. No circular relationships between entities (usually)

Page 10: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

A word about data definitions

• There is no definitive set of information to define data

• There is some basic information that will always be needed

• Do what you need to do in order to define the data

• The following has worked during real-life project and is a proven starting point

Page 11: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Process for defining the data

• For each entity on the diagram– Define the entity– Define it’s relationships– Identify non-key attributes from

• Process specs• User input• Your analysis of requirements• …but always verify they are in scope!

– Define attributes

Page 12: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Data definitions - Entities• what the entity really is – ‘legal’ definition

• Example: the “Sale” entity is a record of when a Product was purchased by a Customer

• The (non-functional) requirements the business has for entities– Attributes

• example: Date, Quantity– Retention period

• example: 6 years – justification: legal requirement– Max volume (max number of instances)

• Example: 60,000 based on average number of sales per year of 10,000 x retention period

– Examples (not a requirement but very useful) • Example: On 28/4/2011 a flange was sold to Fred Bloggs

Page 13: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Data definitions - Relationships

• What the relationship really is – ‘legal’ definition– Example: For the relationship “Customer

purchases Sale” – A Customer agrees to make immediate and full payment for a Product which is given to the Customer at the time the Sale is made.

• The (non-functional) requirements for relationships is the cardinality – already defined in the diagram

Page 14: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Data definitions - Attributes• What the attribute really is – ‘legal’ definition

– Example: On entity Sale the attribute “Date”: the day and time the Sale was agreed with the Customer

• The (non-functional) requirements the business has for them– Data type

• Example: Numeric– Size

• Example: 12– Domain – not all attributes will have a domain

• Example: Timestamp YYYYMMDDHHMM– Rules – not all attributes will have a rule(s)

• Example: Cannot be a Sunday or Bank Holiday and must be between 09:00 and 17:30 and always display as YYYY-MM-DD:HH.MM

– Examples (not a requirement but very useful)• Example: 2011-04-28:10.05

Page 15: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Minor Exercise

I own a florist’s shop called My Florist.

I want to start emailing reminders to customers when special occasions are due for which they have brought flowers in the past – for example a spouse’s birthday.

We have already got a data model of the requirements so lets define the data for Customer.

Page 16: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

An answer…Entity Definition Attribute

sRetention Period

Max Volume

Examples

Customer

Relationship DefinitionCustomer needs Reminder

Attribute

Definition Data Type Size Domain Rules Example

Customer.Email Address

Someone who purchases flowers from My Florist

Email Address 3 years 9900

(3 years, 302 working days per year, 15 customers per day)

[email protected]

The customer has purchased flowers from My Florist for a Special Occasion in the past, so reminders need to be sent just before the anniversary of the event.

The email address given by the customer at the point of sale of flowers for a Special Occasion

Character Unlimited Email address None [email protected]

Page 17: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

Major Exercise• You are business analysts working for a company

called re-Evolution Coffee Houses Ltd• You have been given a piece of work – ref handouts• You have already produced a data model showing

– Entities– Primary Keys– Relationships

• Define the data entities, relationships and attributes.• Suggestion: follow the process for producing a data

model diagram 6 slides previously• The business users will be available for questions

Page 18: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

• If you need to make an assumption about business requirements or anything else then document it

• Time allowed: 45 minutes• Deliverable:

– Flip chart data definitions– Flip chart assumptions

• Be prepared to present your data definitions to the other team

• Don’t worry about completing the exercise• Do worry about the quality of what you get through

Major Exercise

Page 19: Bite sized training sessions: Data Modelling – Part 2 of 2 Data Definitions.

…and finally

• Any questions?

• Further resources…

• Feedback

• Thank-you!