Upload
norman-edwards
View
222
Download
2
Embed Size (px)
Citation preview
Conceptual DesignConceptual DesignRevisionRevision
Database DevelopmentDatabase Development
Basic constructs of theBasic constructs of theEntity Relationship ModelEntity Relationship Model
EntityEntity Representation of an Entity on an ER Representation of an Entity on an ER
diagram is:diagram is:– a box with square corners a box with square corners – labelled with the entity name.labelled with the entity name.
Note – the entity name is always singularNote – the entity name is always singular
Student
Basic constructs of theBasic constructs of theEntity Relationship ModelEntity Relationship Model
Weak EntityWeak Entity Representation of a Weak Entity on Representation of a Weak Entity on
an ER diagram is:an ER diagram is:– a box with rounded corners a box with rounded corners – labelled with the entity name (singular)labelled with the entity name (singular)
NextOfKin
Basic constructs of theBasic constructs of theEntity Relationship ModelEntity Relationship Model
Strong EntityStrong Entity By default an entity which is not a By default an entity which is not a
weak entity is a strong entity.weak entity is a strong entity.
Student
ER Model Relationship ER Model Relationship TypesTypes
One to OneOne to One– An employee is allocated a single An employee is allocated a single
parking space, a parking space belongs parking space, a parking space belongs to only one employee.to only one employee.
1:1Employee ParkingSpace
ER Model Relationship ER Model Relationship TypesTypes
One to ManyOne to Many– A department has many employees A department has many employees
assigned to it, each employee is assigned to it, each employee is assigned to only one department.assigned to only one department.
1:MDepartment Employee
ER Model Relationship ER Model Relationship TypesTypes
Many to ManyMany to Many– An employee attends many staff An employee attends many staff
development sessions, each staff development sessions, each staff development session is attended by development session is attended by many employees.many employees.
N:MStaffDevSess Employee
ER Model Relationship ER Model Relationship TypesTypes
Many to ManyMany to Many– An employee attends many staff An employee attends many staff
development sessions, each staff development sessions, each staff development session is attended by development session is attended by many employees.many employees.
N:MStaffDevSess Employee
ER Model Relationship ER Model Relationship TypesTypes
InheritanceInheritance– A technician is a A technician is a
kind of employee kind of employee about whom we about whom we wish to record, in wish to record, in addition to his addition to his other attributes, his other attributes, his highest technical highest technical qualification.qualification.
Technician
Employee
ER Model Relationship ER Model Relationship ExistenceExistence
In the ER model optional association In the ER model optional association existence is shown as.existence is shown as.
An employee may be a member of An employee may be a member of one of the works football teams.one of the works football teams.
1:MFootballTeam Employee
ER Model Relationship ER Model Relationship ExistenceExistence
In the ER model mandatory In the ER model mandatory association existence is shown as.association existence is shown as.
An employee must be a member of An employee must be a member of one of the unions recognised by the one of the unions recognised by the company.company.
1:MUnion Employee
ER Model RelationshipER Model Relationship
Recursive relationship.Recursive relationship. An employee may also be a An employee may also be a
manager. A number of employees manager. A number of employees are managed by a single managerare managed by a single manager
Employee
1:MEmployee Manager
AttributesAttributes
What is an attribute?What is an attribute? An attribute is a piece of information An attribute is a piece of information
about the object or event that we wish about the object or event that we wish to store in our database.to store in our database.
It can be said to describe the object.It can be said to describe the object. An example of some possible attributes An example of some possible attributes
for Employee could be EmployeeID, for Employee could be EmployeeID, EmpFirstName, EmpSurnameEmpFirstName, EmpSurname
ER Model Representation of ER Model Representation of AttributesAttributes
Only attributes which uniquely Only attributes which uniquely identify an entity will be represented identify an entity will be represented on your ER diagram.on your ER diagram.
A key attribute may be represented A key attribute may be represented as followsas follows
Employee
EmployeeID
ER DiagramER Diagram
STUDENT HALLN:1
StudentID HallName
Entity Entity Name
Relationship
Cardinality
Attribute Attribute name
Mandatory Existence
Optional Existence
Diagram ScriptDiagram Script
Entity name Attributes Identified Synonym Related to
Course titlecourseCode
Prerequisite StudentClassCourse
Student studentIDstudentNameaddresspostcode
Course
Class semesterclassRoomuniqueClassNametutor
Course
Relationship between course and student
grade Course and Student
Using the Information BaseUsing the Information Base
Where do we start?Where do we start? Analyse the information gathered Analyse the information gathered
during the requirements analysis.during the requirements analysis.– One element at a timeOne element at a time
Identifying EntitiesIdentifying Entities
A noun is a word that names a person or A noun is a word that names a person or thing thing
A noun phrase is a group of words that A noun phrase is a group of words that operate like a noun e.g. dentist operate like a noun e.g. dentist appointmentappointment
Consider each noun or noun phrase and Consider each noun or noun phrase and determine if it is a candidate entity.determine if it is a candidate entity.
Reasons for rejecting candidate entities.Reasons for rejecting candidate entities.
Rejecting Candidate EntitiesRejecting Candidate Entities
RedundancyRedundancy VaguenessVagueness An event or operationAn event or operation Meta LanguageMeta Language Outside the system boundaryOutside the system boundary AttributeAttribute
Next WeekNext Week
In-class testIn-class test