Documente Academic
Documente Profesional
Documente Cultură
database
Reading:
e.g. Connolly/Begg DB systems: (4th ed) Ch 16 – step 2.2
and/or (3rd ed) Ch 15.1
1
BookTitle BookCopy
Reader
ISBN {PK} Has copyID {PPK} Borrows
readerNo {PK}
author [1..*] 1 1..20 loanType 0..* 0..*
name
title purchaseDate
firstName
mainTitle shelf dateOut
lastName
subTitle returnDate
address
publisher \dueDate
year \fine
Let’s start with the steps we need for the books example
3
Steps Summary (from Connolly/Begg)
1. Strong entities
2. Weak entities
3. Binary 1:* relationships
4. Binary 1:1 relationships
5. Recursive 1:1 relationships
6. Super- and subclasses
7. Binary *:* relationships
8. Complex relationships
9. Multi-valued attributes
4
Steps 1&2: Entities
6
Step 3: (1:*) Relationships
Note: Apply same method for unary *:*: create a new table, with
two foreign keys both linking to the original PKs
8
Step 9: Multi-valued attributes
9
Step 4: Binary (1:1)
11
Step 4 Example
Manager Branch
managerID {PK} 1..1 Manages 0..1 bName {PK}
name address
salary phone
• “Each branch has one manager, each manager may
manage a branch (but those at head office don’t)”
12
Step 5: Unary (Recursive) 1:1
1..1
Supervises “Each staff member
Staff has one supervisor
ID {PK} 0..1 and may supervise
name one staff member”
department
*****************************************************************
Note that if you read any other database textbook or access any websites you may
see other descriptions of the mapping “recipe”. They all do the same thing! We use
the numbering of Connolly and Begg DB Systems. DB solutions uses the same
method but no numbering.
*****************************************************************
15
What about unary (recursive) relationships?
16
Summary
Follow 9 Step procedure
– should result in a “good” relational model,
i.e. at least in 3rd Normal Form
– Be careful!!!
– Remember to identify Primary Keys
For relationships:
– Identify one relation as “parent”, one as “child”
– post parent’s PK to child as FK
17
Summary ctd.
18