Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CS263 Lecture 9
Division
operates reports to
Branch
Staff
001 002 003
Division
D1 D2
Branch
B03 B02 B04
Branch
Staff
Division
D1 D2
Branch
B03 B02 B04
Staff
002 001 003
Developing an ER Diagram
Step 1 Identify Entities Step 2 Work out relationships Step 3 Identify Attributes Step 4 Identify optionality Step 5 Identify KEY attributes (Resolve any assumptions)
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Example Problem 1
A college library holds books for its members to borrow. Each book may be written by more than one author. Any one author may have written several books. If no copies of a wanted book are currently in stock, a member may make a reservation for the title until it is available. If books are not returned on time a fine is imposed and if the fine is not paid the member is barred from loaning any other books until the fine is paid.
Member
Book
Author
Title
Member
Book
Author
Title
Member
Book
Serial Number. Condition. Date Purchased.
Author
EACH
Title
Written by Writes Borrows
Member
On loan
Book
Author
Title
RESERVES
Writes Borrows Written by
Member
On loan
Book
FINE
Author
BARRED
Title
Reserves Reserved By Borrows Writes Written by
Member
On loan
Book
MUST
Author
Fine
MAY
ER Diagram One
Title
Reserves Reserved Has Has By Writes Borrows Written by
Member
On loan
Has Imposed on For
Book
Results in
Author
Fine
ER Diagram Two
Reserve
Title
T_A
Member
M_B
Book
Author
Fine
Identify Keys
Reserve
T#
Title
T_A
M#
Member
B#
A#
M_B
Book
Author
F#
Fine
T#
Title
T#,A#
T_A
M#
Member
M#,B# Borrow
B#
T#
A#
Book
Author
F# M#,B#
Fine
Example Problem 2
A global enterprise has three companies, and each company has between two and six departments. Each department employs one or more employees (although certain company employees may not currently be attached to a department), who, as well as possibly having a number of dependants, may well have an associated set of employment history notes. State any assumptions you make.
Company
Belongs to Operates
Employs
Department
Works for
Employee
Belongs to Has
Has Belongs to
Employment Note
Dependent
Example Problem 3
A local authority wishes to keep a database of all its schools and the school children that are attending each school. The system should also be able to record teachers available to be employed at a school and be able to show which teachers teach which children. Each school has one head teacher whos responsibility it is to manage their individual school, this should also be modelled. State any assumptions you make.
School
Teacher
Teaches Taught by
Child