Top Banner
Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities
25

Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Dec 22, 2015

Download

Documents

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: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Database Design Concepts

Lecture 7

Introduction to E:R ModellingIdentifying Entities

Page 2: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Objectives

To introduce the notation used in E:R modellingTo explain what is meant by an EntityIntroduce a strategy for identifying entities in a given scenarioIntroduce the concept of a relationshipShow how optionality and degree are shown using the notation

Page 3: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Entity Relationship Diagrams Entities and Relationships

An entity is a set of objects of the same type I.e. they have the same properties and they behave in a similar wayEG Student entity

Bob Nazia Jim

Page 4: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Entity

An entity has attributes or properties associated with it Eg Name Age Address

And have relationships with other entities (These are the associations between the entities) Eg A Student is associated with a Course A Course is associated with a number of

Modules

Page 5: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Identifying Entities

We need to identify the things of interest to the users of the system

Things

Tangible Things

Airplane Book Vehicle

Roles Played

Employee Student Lecturer

Organisational Units

Warehouse Department Accounts Section

Event, incidents or interactions

Flight, Order, Contract, Invoice, Payment Service call

Page 6: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Identifying the Entities

One method is to identify all nouns associated with the system

1. List all the nouns the users mention in their description of the system

2. Review all documentation including sample forms from the existing systems

3. Make a list of all these nouns

Page 7: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Identifying the Entities

For each noun on the list for it to be included (stay on the list)

1. Is it a thing the system needs to know about?

2. Is it inside the scope of the system?3. Is there more than one of these objects?

If the answer is yes to all of these question it stays on the list. If not remove it

Page 8: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Remove a noun from the list if you can answer yes to any of these questions

1. Is it another name for something already on the list?

2. Is it an input or output from the system that can be produced from other information you have identified?

3. Could it be a property of some other thing you have identified?

4. Are you unsure of any of these answers? if so note it for further research

Page 9: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

At the end of this exercise we have a list of entities After follow up research to clear up

any we are not sure about. Do not worry about missing any, they

will turn up.

Page 10: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Relationships between Entities

An association between entities ( in simple terms)

Customer places an orderStudent enrols on a course

Page 11: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Properties of Relationships/ Associations

Often described by a verbOften bi-directional Customer places an order Order is placed by a customer

Have multiplicity For each direction

Customer places many orders Order is placed by exactly one customer

Shown by a line

Page 12: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Enterprise rules

When we draw an E:R model we need to identify all the relationships between that entity and other entities

These are known as Enterprise rules- these describes the rules the business usesEg a student can only ever enrol on one courseHowever another college may allow students to enrol on more than one course.This information comes from systems investigation and we need to know, to be able to design a useful database

Page 13: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

ER DiagramAn ER Diagram is a pictorial representation of Entity (type) level enterprise rules within the boundary of what exists or is required

Basic notation of ER Diagram: NB - the colours are not part of the syntax

= Entity = Relationship

Employee Machineworks onOften hard to name the relationship.

Page 14: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Participation ConditionOtherwise called Membership Class

Type of participation of an entity in a relationship Obligatory

every occurrence of an entity must participate

OR Non-Obligatory

occurrence(s) of an entity can exist without participating in the relationship.

Page 15: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Participation Condition is shown as a dot or blob

Enterprise Rules Represented:“An employee must work on one or many machines” (dot inside)

“A machine is worked on by zero, one or many employees”

(dot outside)

Employee MachineWorks on MM

Page 16: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Example E:R Diagram

Student

Module

Registers on

m

m

Page 17: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Multiplicity

Shown by the use of 1or m on the relationship0 shown by circle outside entity boxCircle inside box says there must be at least 1From the example

A (one,each) student must be registered on one or more modules

Other wayA module has 0, one or more students registered on it

Page 18: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

A student enrols on exactly one course Reading the relationship the other wayA course may have 0, one or more students enrolled on it

More Examples of multiplicity

StudentCourse

enrols1

m

Page 19: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

An employee may have one carAndA car must belong to exactly one employee only

Employee Car

Has

11

Page 20: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Project Works_on Works_in

Based_in

Dept

Room

Fill in the degree of association (0,1,m etc.) and participation conditions (dots) (You will need to make a few assumptions).

Employee

Page 21: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Employees may work on several projects but some employees do not work on projects. New projects may have no employees assigned. Some projects have many employees involved. Each employee is in just one department. Some employees are assigned a single room, others are not assigned a room at all. Rooms are usually shared

Page 22: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Guidelines

The dots on m:m relationships are usually outside (non-obligatory)The dot that goes with the m of a 1:m relationship is usually outside too (that’s the dot beside the 1)These are very good guidelines for beginners to apply You need to be very sure of any

variation from these two guidelinesThe other useful rule to remember is that 1:1 relationships are quite rare If you have one it’s probably WRONG!

Page 23: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

NotationsMany notations are used for Entity-Relationship modelling

We use the Chen notation, which is particularly good for beginners. It is not the same notation as in some of the text books. The meaning and concepts are the same whatever the notation

It is important that you do not mix the notation in a model.

Page 24: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

Summary

You should now know what is meant by an entityBe able to ‘read’ an E:R model

Page 25: Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.

References

Satzinger, Burd and Jackson Systems analysis and design in a changing world Chapter