Bemm459j Week 2
Bemm459j Week 2
Basic elements
2022
What we will cover in this session
The idea:
Build an (visualisation) solution to facilitate the exploration of films.
Initial steps:
– Draft a model:
– Of an solution (application).
– Of a database.
Use cases are part of the modelling of solutions
.
Table Film
.
Attributes
FILM ID FILM TITLE FILM YEAR START GENRE ID
tt0031 All at Sea 1940 CM
tt0032 Gambling on the High Seas 1940 AC
tt0033 Mystery Sea Raider 1940 DR
tt0037 Saps at Sea 1940 CM
tt0039 The Sea Hawk 1940
tt0023 Social Sea Lions 1940 CM
.
Table Film
.
Attributes
FILM ID FILM TITLE FILM YEAR START GENRE ID
tt0031 All at Sea 1940 CM
tt0032 Gambling on the High Seas 1940 AC
tt0033 Mystery Sea Raider 1940 DR
tt0037 Saps at Sea 1940 CM
tt0039 The Sea Hawk 1940
tt0023 Social Sea Lions 1940 CM
Tuples
.
Table Genre
.
Characteristics: each row describes a single entity occurrence
.
.
Characteristics: all values in a column match the the attribute
characteristics
.
.
Characteristics: The column’s range of permissible values is known as
domain
.
.
Characteristics: the order of rows does not affect the user
.
.
Characteristics: each table must have a primary key
.
.
But it can have others. For example, a secondary key
.
.
Small database
.
GENRE ID GENRE NAME
CM Comedy
AC Action
DR Drama
DC Documentary
.
Small database
.
GENRE ID GENRE NAME
CM Comedy
Primary key:
AC Action GENRE ID;
DR Drama Foreign key: None.
Primary key: DC Documentary
FILM ID;
Foreign key:
GENRE ID
.
Small database – UML representation
FILM
FILM ID GENRE
FILM TITLE GENRE ID
FILM YEAR START GENRE NAME
GENRE ID
Small database – UML representation
FILM
FILM ID GENRE
FILM TITLE is of I GENRE ID
FILM YEAR START 0..1 GENRE NAME
GENRE ID
Small database – UML representation
FILM
FILM ID GENRE
FILM TITLE is of I GENRE ID
FILM YEAR START 0..* 0..1 GENRE NAME
GENRE ID
Small database – UML representation
FILM
FILM ID {PK} GENRE
FILM TITLE is of I GENRE ID {PK}
FILM YEAR START 0..* 0..1 GENRE NAME
GENRE ID {FK1}
Small database – UML representation
GENRE
GENRE ID {PK}
GENRE NAME
0..1
N
is of
0..*
FILM
FILM ID {PK}
FILM TITLE
FILM YEAR START
GENRE ID {FK1}
Small database
Tables UML diagram
.
GENRE ID GENRE NAME
CM Comedy GENRE
Primary key:
AC Action GENRE ID; GENRE ID {PK}
DR Drama Foreign key: None. GENRE NAME
Primary key: DC Documentary
FILM ID; 0..1
Foreign key:
GENRE ID
N
FILM ID FILM TITLE FILM YEAR START GENRE ID is of
tt0031 All at Sea 1940 CM
tt0032 Gambling on the High Seas 1940 AC 0..*
tt0033 Mystery Sea Raider 1940 DR FILM
tt0037 Saps at Sea 1940 CM FILM ID {PK}
tt0039 The Sea Hawk 1940 FILM TITLE
FILM YEAR START
tt0023 Social Sea Lions 1940 CM
GENRE ID {FK1}
.
Let’s give it a try with this use case:
Requirement: Every painting has an author and each painter can create one or
more paintings.
Another exercise. Imagine the following use case:
EMISSION
COUNTRY EMISSION ID {PK}
COUNTRY ID {PK} has I COUNTRY ID {FK1}
COUNTRY NAME 1..1 0..* YEAR EMISSION
QUANTITY EMISSION
Readings
Chapter 2 of