Download presentation
Published byLiliana Mitchell Modified over 9 years ago
1
Library Management System -- Relational Data Model
Group 5 Paul Li Babu Nepali April 30, 2008
5
Subclassing library items
The catalog must support multiple item types (books, CDs, etc.) This is a superclass/subclass relationship. There are multiple ways to implement this.
6
Subclassing library items
An ITEM table holds attributes common to all library items A separate BOOK table holds attributes that are specific to books. Every book is represented by both an ITEM record and a BOOK record. They have the same primary key value. An “ItemType” column in ITEM allows quick determination of the item type.
7
Subclassing (cont.) ItemID INT (PK) ItemID INT (PK, FK)
BOOK ItemID INT (PK) ItemType = 1 Title VARCHAR(255) PublisherID INT ... ItemID INT (PK, FK) ISBN VARCHAR(13)
8
Subclassing (cont.) ItemID INT (PK) ItemType = 2
Similarly for “audio-visual” items: ITEM AUDIO_VISUAL ItemID INT (PK) ItemType = 2 Title VARCHAR(255) PublisherID INT ... ItemID INT (PK, FK) Length VARCHAR(45)
9
Late fees A fine is charged for each day an item is overdue.
The total fine for an item cannot exceed a maximum amount. Both the rate and amount are determined by the item type.
10
Late fees (cont.) ... ... DateDue FinePerDay DateReturned MaximumFine
ITEM_LOAN ITEM_LOAN ... DateDue DateReturned FinePaymentDate ... FinePerDay MaximumFine
11
Late fees (cont.) Fine for a single overdue item:
MAX( MaximumFine, (DateReturned – DateDue) x FinePerDay ) A librarian records a payment by setting FinePaymentDate to the current date.
12
Late fees -- limitations
Patrons cannot pay an arbitrary amount. An overdue item must be returned before the fine may be paid. (why?) To increase the fine amount per date, the data model must be expanded. (why?)
13
Password hashes Password hashes are stored in the PATRON and LIBRARY tables instead of the actual passwords. “my_password” --> 041e0f26ab2429fb When a user enters his password, the application recomputes the hash and compares it with the user's record.
14
Password hashes (cont.)
If someone steals my laptop, he would still not be able to log on to the system.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.