Professional Documents
Culture Documents
Introduction: Lifecycle
Requirement analysis Conceptual Design Logical Schema Design Physical Schema Design
FU-Berlin, DBS I 2006, Hinze / Scholz
-> Text
Name Name SID VName Studentin (1,*) anmelden (0,*) Kurs Vorgnger (0,*) (1,1) (0,*) Nachfolger VName Dozentin (1,*) halten DID Email
-> ER-Model
voraussetzen
CREATE TABLE Studentin (SID INTEGER PRIMARY KEY, VName CHAR(20) Name CHAR(30) NOT NULL, CREATE TABLE Kurs Email Char(40)); (KID CHAR(10) PRIMARY KEY, Name CHAR(40) NOT NULL, Dauer INTEGER); CREATE TABLE Anmelden (SID INTEGER PRIMARY KEY FOREIGN KEY REFERENCES Studentin (SID), KID INTEGER PRIMARY KEY FOREIGN KEY REFERENCES Studentin (KID));
Administration
1.2
1.3
Requirement Analysis
Customer communication! Identify essential "real world" information Remove redundant, unimportant details Clarify unclear natural language statements Fill remaining gaps in discussions Distinguish data and operations Requirement analysis & Conceptual Design aims at focusing thoughts and discussions !
1.4
Fill gaps
Any discounts? ...
Distinguish data/operations
Processing a bill Becoming a member of the club
1.8
FU-Berlin, DBS I 2006, Hinze / Scholz
Attribute Relationship:
Tape
property of an entity Examples: tape has id, movie has title connects two or more entities Examples: tape contains a movie.
FU-Berlin, DBS I 2006, Hinze / Scholz
Tape
id
contain
Movie
title
Student
Title LID hours
FU-Berlin, DBS I 2006, Hinze / Scholz
attend Lecture
attend
Lecture
LID: Number Title: String hours: Number
1.10
Tape
FU-Berlin, DBS I 2006, Hinze / Scholz
Movie
title director category
id
Entity_1
relationship
Entity_2
attribute
Always have a name Do not have a key! Not always reflected by the relationship name see example: "rents" is equivalent to "is-rented_by"
FU-Berlin, DBS I 2006, Hinze / Scholz
Customer
rents
Tape
1.12
(without customers)
category year director id
Tape
hold
Movie
Price_per_day
belong_to
play
length
Format
Actor
birthday real_name
1.14
name
charge
stage_name
Recursive relationships
Lecture predecessor require role name successor parent have
1.15
FU-Berlin, DBS I 2006, Hinze / Scholz
Person child
Lecturer
hold
Lecturer
belong_to
Lecture_date rating
1.16
1.17
Attribute restrictions
Attribute contain at most one value: unstructured attribute restriction of E-R M. Key attributes are unique Attribute must / may have a value e.g., movie must have title, director is not necessarily known Value may be restricted e.g., movies are made after 1900 : movie.year > 1900 Special restrictions not in E-R model!
1.18
hold
Tape
play
Actor
1.19
R
1
k2
E2
Tape
rent
Customer
Min-Max Notation:
(0,1)
(min1,max1)
E1
R
(min2,max2)
E2
Tape
rent
(0,*)
Customer
Each tape is rented by 0-1 customers Each customer has rented 0-N tapes
1.20
have
(1,1)
driversLicence
1:N relationship
Movie Lecture (1,*) (1,1)
hold hold
Tape
(1,1)
Lecturer
(0,*)
N:M relationship
FU-Berlin, DBS I 2006, Hinze / Scholz
User_account
(0,*)
has
emailMessage
(1,*)
R is 1:N R is a partial function R: E2 E1 for all extensions of R e2 E2: |{e1 | e1 E1 (e1,e2) R }| 1 R is 1:1 E2 E1 is a injective partial function R is M:N R is a relation, but not a function (R,E1) has (min1, max1) for all extensions of R and for all x E1 min1 |{y| y E2 (x,y) R }| max1 (R,E2) has (min2, max2) for all extensions of R and for all y E2 min2 |{x | x E1 (x,y) R }| max2
1.22
(without customers)
category year director id
Tape (1,1)
belong_to
(1,1)
hold
(1,*)
Price_per_day length
(0,*) Format
FU-Berlin, DBS I 2006, Hinze / Scholz
name
charge
stage_name
(1,*)
(0,*)
(0,1)
(1,1)
N or M
1 ..* k..j k
N or M
0 ..* * 0 .. k
0 .. 1
(1,1)
Room
Notation:
E1
(min1,max1)
(min2, max2)
E2 id
id
FU-Berlin, DBS I 2006, Hinze / Scholz
min2 = 1 : at least one e1 for each e2, otherwise e2 could not be identified max2 = 1
1.25
has
(1,1)
Scene
(1,*)
has
(1,1)
Item
Iid
employee
eid
has
child
or
cid
eid
FU-Berlin, DBS I 2006, Hinze / Scholz
employee
(0,*)
has
(1,1)
child
vid
until
1.28
Format (0,*)
belong_to
hold (1,1)
(1,*)
Movie (0,*)
length
(1,1)
id
Tape (0,*)
is_in
Address Telephone
(1,1)
FU-Berlin, DBS I 2006, Hinze / Scholz
from until
Rental (1,1)
have
(0,*)
Customer
real_name
1.29
recommend
(1,*)
Textbook
Lecture
Cardinalities:
A particular lecturer recommends zero or more "(textbook,lecture) pairs" For each lecture at least one textbook is recommended by lecturers
here, (min,max)-constraints not very expressive
1.30
FU-Berlin, DBS I 2006, Hinze / Scholz
E2
N Textbook
Lecture
FU-Berlin, DBS I 2006, Hinze / Scholz
1.31
Topic
Student
Student is allowed to have only one topic for each Prof. Student is allowed to have only one Prof. for each topic Profs. are allowed to use the same topic again A topic can be used be used by many Profs., but for different students
1.32
Textbook
Lecture
Less constraints expressible! 2. New central entity, binary relationships to old ones
Lecturer
FU-Berlin, DBS I 2006, Hinze / Scholz
Lectureplan
Lecture
Textbook
1.33
Lecturer
hold1
Student
FName
FU-Berlin, DBS I 2006, Hinze / Scholz
attend hold2
Lecture
hours title
LID
Student
FU-Berlin, DBS I 2006, Hinze / Scholz
Lecturer
Contract
SID
DB Interpretation of Generalization differs from OO! instances of Student and Lecturer also instances of Person Student Person, Lecturer Person
1.35
DB interpretation:
Instances of B and C also instances of A: B A and C A Key-inheritance "is-a" different from ordinary relationships
Special cases:
Disjoint specialization: Instances of B and C are disjoint Complete specialization: A = B C, no extra tupel in A
1.36
Important terms
Entity (type, set): set of objects with the same attributes Attribute: property of an entity, at most one value per attribute. Relationship (type): association between entity types Role: name of one side of relationship Cardinality (multiplicity): number of entity objects that participate in relationship Weak entity: existentially dependent entity Generalization
1.37