Docsity

Entity Relationship Modelling - Database Systems - Lecture Slides, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Entity Relationship Modelling - Database Systems - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Entity/Relationship Modelling

Entity/Relationship Modelling

  • E/R Modelling is

used for conceptual

design

  • Entities - objects or items of interest
  • Attributes - facts about, or properties of, an entity
  • Relationships - links between entities

• Example

  • In a University database we might have entities for Students, Modules and Lecturers. Students might have attributes such as their ID, Name, and Course, and could have relationships with Modules (enrolment) and Lecturers (tutor/tutee)

Entities

  • Entities represent

objects or things of

interest

  • Physical things like students, lecturers, employees, products
  • More abstract things like modules, orders, courses, projects - Entities have - A general type or class, such as Lecturer or Module - Instances of that particular type, such as Steve Mills, Natasha Alechina are instances of Lecturer - Attributes (such as name, email address)

Diagramming Entities

  • In an E/R Diagram,

an entity is usually

drawn as a box with

rounded corners

  • The box is labelled

with the name of the

class of objects

represented by that

entity

Student

Lecturer

Module

Tutors

Studies

ID

Name Course

Diagramming Attributes

  • In an E/R Diagram

attributes may be

drawn as ovals

  • Each attribute is

linked to its entity by

a line

  • The name of the

attribute is written in

the oval

Student

Lecturer

Module

Tutors

Studies

ID

Name Course

Relationships

  • Relationships are an

association between

two or more entities

  • Each Student takes several Modules
  • Each Module is taught by a Lecturer
  • Each Employee works for a single Department - Relationships have - A name - A set of entities that participate in them - A degree - the number of entities that participate (most have degree 2) - A cardinality ratio

Diagramming Relationships

  • Relationships are

links between two

entities

  • The name is given in

a diamond box

  • The ends of the link

show cardinality

Student

Lecturer

Module

Tutors

Studies

ID

Name Course

One Many

Removing M:M Relationships

  • Many to many

relationships are

difficult to represent

  • We can split a many

to many relationship

into two one to

many relationships

  • An entity represents

the M:M relationship

Student

Module

Studies (^) Enrolment

Student

Module

In

Has

Example

A university consists of a number of

departments. Each department offers several

courses. A number of modules make up each

course. Students enrol in a particular course

and take modules towards the completion of

that course. Each module is taught by a

lecturer from the appropriate department, and

each lecturer tutors a group of students

Example - Entities

A university consists of a number of

departments. Each department offers several

courses. A number of modules make up

each course. Students enrol in a particular

course and take modules towards the

completion of that course. Each module is

taught by a lecturer from the appropriate

department, and each lecturer tutors a group

of students

Example - E/R Diagram

Course Module

Department

Student

Lecturer

Entities: Department, Course, Module, Lecturer, Student

Example - E/R Diagram

Course Module

Department

Student

Lecturer

Offers

Each department offers several courses

Example - E/R Diagram

Course Module

Department

Student

Includes Lecturer

Offers

Enrols In

Students enrol in a particular course

Example - E/R Diagram

Course Module

Department

Student

Includes Lecturer

Offers

Enrols In

Takes

Students … take modules