20
Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

  • View
    216

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Database design conceptsinfo1408

Lecture 8

Worked example of E:R Modelling

Page 2: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Objectives

We will use a simple scenarioWe will identify the entitiesIdentify the relationships between the entities ( if any)For each relationship the multiplicity ( or degree) and optionality will be determined

Page 3: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

To create an E:R Model

You would use the results of your fact finding to identify the entities ( as we did last week)In this case we will use a scenario

Identify the entities from the scenario

Page 4: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

The Scenario

A small Cinema club runs a number of cinemas throughout the region. The cinema shows films. A film is shown several times over a week ( or more) known as a showing. Each film can have several showings. Members book tickets for a particular showingIdentify the entities

Page 5: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

A small Cinema club runs a number of cinemas throughout the region. The cinema show films. A film is shown several times over a week ( or more) known as a showing Each film can have several showings. Members book tickets for a particular showing.

Page 6: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Each entity is represented as a Box

Page 7: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Refer back to the scenario and identify the relationships

The cinema show films.

Therefore there is a relationship between cinema and film Shown by a line- named shown at

Page 8: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Identify the properties of the relationship

How many cinemas can a film be shown at? How many films can a cinema show?

Does a cinema have to show a film in order to be on our database as a cinema?Does a film have to be shown at a cinema in order to be on our database?

Page 9: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

How many cinemas can a film be shown at? Many How many films can a cinema show? ManySo the relationship is many to manyDoes a cinema have to show a film in order to be on our database as a cinema? No- optionalDoes a film have to be shown at a cinema in order to be on our database? Yes- mandatory

Page 10: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling
Page 11: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

A film is shown several times over a week ( or more) and in several of the clubs cinemas. Each film can have several showings.

Page 12: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Showing and filmRelationship name-screens

A showing shows how many films?A film can have how many a showings?

A film must have a showing to be on database?A showing must have a film to show to be on the database?

Page 13: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

A showing shows how many films? 1A film can have how many a showings?Many

A film must have a showing to be on database? Yes-mandatoryA showing must have a film to show to be on the database? Yes -Mandatory

Page 14: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling
Page 15: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Add to existing diagram

Page 16: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Members book tickets for a particular showing

How many bookings can a member make for a showing?A Showing has bookings made by how many members?

A showing must have a booking ?A member must have made a booking?

Page 17: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

How many bookings can a member make for a showing? manyA Showing has bookings made by how many members? many

A showing must have a booking ? No- OptionalA member must have made a booking? No -optional

Page 18: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Add to diagram

Page 19: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

Summary

The many to many relationships are not appropriate to the final design- we will look at what to do with them next week.We have taken entities and identified the relationships between the entities.Relationships have been described and recorded using the prescribed notation.

Page 20: Database design concepts info1408 Lecture 8 Worked example of E:R Modelling

References

Data Analysis for database Design By D R Howe