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

Post on 20-Dec-2015

220 views 1 download

Tags:

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

Database design conceptsinfo1408

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

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

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

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.

Each entity is represented as a Box

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

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?

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

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

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?

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

Add to existing diagram

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?

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

Add to diagram

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.

References

Data Analysis for database Design By D R Howe