DATA MODELLING

Participated this project to develope a data model using the Entity, Relation, Attribute approach to design a relational database model encompassing the needs of the Toronto Public Library as they move towards full automation.

The purpose is to improve patron satisfaction by automating the entire book borrowing process. In particular, full automation will improve the efficiency between library branches.

Developed skills on:

  • Implementing the ERA(Entity, Relation, Attribute) approach to design a relational data model
  • Interpreting situation descriptions to develop an efficient relational data model
  • Creating ER(Entity Relationship) diagrams that illustrate the data model
  • Task sharing
  • Time management

l. ASSUMPTIONS

  1. The design focuses on books only.
  2. The library is considering converting to barcode cataloguing. A barcode attribute has been added to the Book.Copy Table in preparation for the conversion.
  3. Plans for completing library transactions if the system goes down: rather than rely on Card catalogue (maintenance costs are too great) employees will fill out forms that include library card number, and book id. When the transaction is later input into database, the current date will be overridden by the actual date of the transaction.
  4. The book purchase process has been fully automated. Library heads use the Purchase Order Screen to list the books to be purchased for their branch. The White Hot Books list appears as a secondary screen and acts as a reminder to the Head Librarians that they must either select or reject these items.
  5. Employees are not treated as a special kind of patron if /when they use library services.
  6. Library employees process interloan requests. When the requested book becomes available, a library employee will telephone the patron and inform them that the book is in their branch and that it will be held for three days.
  7. The Cutter# that has made up a portion of the Call# for non-fiction books will not be modeled. This identifier is considered redundant data since it can be recreated from the title and author name.
  8. The front end programmer is responsible for designing an application that will support our data model, including performing necessary calculations, e.g. dynamically changing the overdue balance when a patron makes a fine payment. This application will use an interface that supports the necessary input and output screens, e.g. book loan and book return.

lI. DESCRIPTION OF TABLES (36 tables)

AUTHOR

This table lists authors by an identification number. This I.D. is used for the AUTHOR/BOOK table to list multiple authors and to cross-reference pseudonyms, nicknames or married names.

AUTHOR SURNAME is labelled N.N., but AUTHOR GIVEN NAMES is not. This is because some people have only one name. Subtleties of multiple surnames and last name first are not dealt with here.

Birth and death dates provide optional information to help separate one author from the next and to provide historical context.

AUTHOR / BOOK

This table represents a many-to-many relationship between the AUTHOR and BOOK entities and allows a book record to indicate multiple authors and an author to have worked on multiple books.

AUTHOR NAME TYPE

Some authors may have pseudonyms or get married and change their names. This table (excerpted here) lists the different kinds of names authors may use. This table is used by the AUTHOR table.

AUTHOR ROLE

Some authors are more precisely an illustrator, co-author, co-editor, editor and so on. This table helps define those roles.

AVAILABLE BOOKS

This is the set of books that central administration indicates it can order. All the columns must be filled in. The DATE OF PUBLICATION column is used particularly when the book is marked P for PENDING PUBLICATION.

AVAILABLE BOOKS -- AUTO-ORDER

This represents the subset of books equivalent to the "White Hot Books" list presently prepared by central administration staff and distributed to branches. These books will automatically be sent to at least some branches unless branches indicate otherwise.

AVAILABILITY CODE

This table lists the short forms for different levels of availability, such as AVAILABLE and PENDING PUBLICATION.

BOOK

This is half the heart of the cataloguing system. It works in conjunction with its dependent, BOOK.COPY.

Many of the fields are optional, mainly because older books in the system may lack precise details about publisher or came out before the ISBN system was developed.

The LOC CARD NUMBER refers to the Library of Congress cataloguing-in-publication system whereby it will catalogue a book even before its released. This allows libraries to refer to its master card information and reduces the time needed to catalogue a book. (Not all books are so catalogued, so this is an optional field.)

The SIZE column has information about the book's height or width, depending on how it will be shelved. (Some shelves will be specifically for oversized books.)

EDITION refers to first, second, third edition and so on.

BOOK.COPY

This contains information specific to the actual copy of a book that a branch has. It's a dependent of BOOK and retains all the attributes of its parent, while adding a COPY primary key to the inherited BOOK key.

The branch that owns the copy and the branch that lends it is distinguished. If a book is not on loan, the LENDING BRANCH I.D. is null. COPY STATUS indicates, for instance, if a book is borrowed, has been destroyed or does not circulate.

The library system is converting to a bar code system for speeding up circulation. However, not all books will be barcoded by the time the cataloguing system is up, so this field is optional.

The FIRST CIRCULATED ON field helps keep track of how often a book is borrowed. This field and the DATE BORROWED field are used to generate the BOOK.COPY CIRCULATION HISTORY table.

BOOK.COPY CIRCULATION HISTORY

This table keeps track of how often a book is borrowed. Library staff review this lending pattern and discard books that are no longer popular.

BOOK.COPY -- FICTION

A subset of BOOK.COPY, it's used to indicate the special call numbers used by fiction books -- a combination of author and library section. For instance, an Asimov book might go in science fiction while a Hammet might end up in the detective section.

BOOK.COPY -- NON-FICTION

Another subset of BOOK.COPY, this table records the Dewey Decimal system call number. The cutter number is not recorded as it contains only redundant information.

BOOK.COPY RECOVERY

This table indicates current status of attempts to recover overdue books.

BOOK.COPY RECOVERY HISTORY

This is a history table listing the various attempts to recover a book in case, for instance, the collector tried more than once to retrieve a book.

BRANCH

This lists the important facts about a branch. Not all branches have fax machines, so this is an optional field. The HEAD LIBRARIAN column uses the EMPLOYEE I.D. key from the EMPLOYEE table. The city is assumed to be TORONTO, hence CITY CODE is not needed.

EMPLOYEE

This table contains most of the important details about an employee. The SUPERVISOR field has a recursive relation to the EMPLOYEE entity via the EMPLOYEE NUMBER key. This field is optional because at least one person (at the very top of the chain) will have no supervisor.

EMPLOYEE -- FULL-TIME

Specifies monthly salary. Also specifies length of time employee has been full-time in case this affects benefits.

EMPLOYEE -- PART-TIME

Specifies hourly wage. Also specifies length of time employee has been part-time in case this affects benefits. (Employee may have switches from full-time to part-time at some point.)

EMPLOYEE POSITION

Matches the EMPLOYEE POSITION I.D. to the name of the position.

LANGUAGE

This table tries to match various possible names for languages (including the name of the language in its own language) to a uniform language code. Used in catalogue search purposes.

LIBRARY SECTION

This table lists the different parts of a library that a fiction book could be placed.

PATRON

This information contains basic information about a patron. Name considerations similar to those in the AUTHOR table were used (for instance, some patrons may use only one name, as occurs in some cultures). TOTAL FINES is derived data but could be omitted if there are no performance issues. A patron is assumed to have an address but not necessarily a telephone number.

PATRON / BOOK

This table does not list patron borrowings (which is recorded under BOOK.COPY) but rather it keeps track of reserve or hold requests on a book. Since it's unpredictable what copy of a book will be the first to be returned, a hold is placed on a title (so to speak) not the actual copy of that title. As more than one patron can place a hold on a book and a patron can place holds on more than one book, this is a many-to-many relationship.

PATRON STATUS

This table keeps track of whether a patron card is valid.

PATRON TYPE

There are presently three categories of patron. This table distinguishes limits and fine policies for each category and matches the type abbreviation to the full type name.

PURCHASE ORDER

This table has the header information for a purchase order. This table is used at the central administrative ordering stage after various branches have initiated branch purchase orders that can be reconciled under one supplier.

PURCHASE ORDER / AVAILABLE ITEM / BRANCH PURCHASE ORDER

This compound-relation table records purchase order items. Because the specifications of this case study indicate purchase orders can mix and match books and branches, three foreign keys are used so that all permutations of central purchase order, item ordering code and branch purchase order can be kept track of.

PURCHASE ORDER -- BRANCH

We assume that branches submit an order for one book title using one branch purchase order.

PURCHASE ORDER STATUS

Indicates how far an order has been processed. Other codes might in this table might include NP for no purchase order returned with order or DD for damaged.

SUBJECT

This matches official subject labels to a subject number. Because one Dewey Decimal number could represent a book with multiple subjects, our relational data model uses a different system.

SUBJECT / BOOK

This many-to-many table accommodates the fact that one book can have many subjects and one subject can be covered in many books.

SUPPLIER I.D.

This table lists important information about suppliers, whether they are vendors, agents or publishers themselves.

SUPPLIER TYPE

This table distinguishes between vendors, agents and publishers.

SUPPLIER / PUBLISHER

For the purposes of our case study, we're assuming that all publishers sell their own books, but agents or vendors may be used for a better price. This table supplies a recursive listing of which suppliers can sell books from which publishers.

TITLE

This table is used to reduce ambiguity in titles and for use in the TITLE / BOOK table.

TITLE / BOOK

This many-to-many table accommodates the fact that two entirely different books can have the same title (such as two different textbooks called CALCULUS) and that a book can have more than one title.

lII. TABLES

AUTHOR

AUTHOR I.D AUTHOR SURNAME AUTHOR GIVEN NAMES AUTHOR NAME TYPE AUTHOR I.D. CROSS-REFERENCE BORN DIED
PK, SA NN   FK, NN      
123456 CARROLL LEWIS P 2241 1832 1898
224144 DODGSON CHARLES A 1234 1832 1898
994298 PRICE RICHARD H. A   1943  

AUTHOR/BOOK

BOOK I.D. AUTHOR I.D. AUTHOR ROLE I.D.
PK, FK PK, FK FK, NN
226316 994278 C
219445 994266 CE
884245 363677 I

AUTHOR NAME TYPE

AUTHOR NAME TYPE AUTHOR NAME CLASS
PK, UA NN, ND
R REAL
P PSEUDONYM
V VARIANT

AUTHOR ROLE

AUTHOR ROLE I.D. AUTHOR ROLE NAME
PK, UA NN, ND
A AUTHOR
E EDITOR
I ILLUSTRATOR
T TRANSLATOR

AVAILABLE BOOKS

ITEM NUMBER AUTHOR I.D. TITLE I.D. PUBLISHER I.D. DATE OF PUBLICATION ISBN LANGUAGE I.D. COST AVAILABILITY CODE
PK, SA FK, NN FK, NN FK, NN NN NN FK, NN NN FK, NN
336968 9191 884256 3641 1989 12 01 0-300-03770-8 14 19.95 A
142945 3321 423345 3245 1993 10 01 0-471-11709-9 1 59.95 D
211945 3434 112256 3245 1999 04 01 0-553-21999-8 1 12.98 P

AVAILABLE BOOKS -- AUTO-ORDER

ITEM NUMBER BRANCH I.D. DEFAULT ORDER NUMBER DEADLINE TO CHANGE
PK, FK FK, NN FK, NN NN
884234 22 1 1999 03 21
113234 22 5 1999 04 28
663287 3 3 1999 02 12

AVAILABILITY CODE

AVAILABILITY CODE AVAILABILITY DESCRIPTION
PK, UA NN, ND
A AVAILABLE NOW
P PENDING PUBLICATION
D DISCONTINUED

BOOK

BOOK I.D. LANGUAGE I.D. EDITION PUBLISHER I.D. PLACE OF PUBLICATION ISBN
PK, SA FK, NN
NN
FK, NN
NN
NN
234269 1 3 1234 NEW YORK 0-332-12223-8
432158 12   5687 NEW YORK 0-332-99232-6
993300 1 2 0899 NEW HAVEN AND LONDON 0-300-03370-8

BOOK (cont.)

LOC CARD NUMBER PAGES VOLUMES SIZE FORMAT HOLD FLAG
ND
NN
NN
NN
NN
NN
95-6472 132 1 32 cm PB YES
93-1123 943 2 64 cm HB NO
  108 1 96 cm PB YES

BOOK.COPY

BOOK I.D. BOOK COPY # OWNER BRANCH I.D. LENDING BRANCH I.D. PURCHASE ORDER NUMBER COPY STATUS CODE
PK, FK PK NN     FK NN
342496 5 13 14 2342347768 O
434398 1 13   3432110098 DD
112309 2 9 15   DNC

BOOK.COPY (cont.)

LIBRARY CARD NUMBER FIRST CIRCULATED ON BAR CODE DATE BORROWED DATE RETURNED
FK  
ND NN
   
224455 98 12 11 933321 98 12 12  
443213 93 08 16 432423    
423422        

BOOK.COPY CIRCULATION HISTORY

BOOK I.D. BOOK COPY # DATE LENT (YY MM DD)
PK, FK, FK1 PK, FK, FK1 PK, FK
324234 3 98 12 11
434322 2 98 12 27
324340 3 99 01 02

BOOK.COPY -- FICTION

BOOK I.D. BOOK COPY# AUTHOR ABBREVIATION SECTION I.D.
PK, FK PK, FK. NN FK, NN
942343 3 DOD CHI
221334 2 PET DET
991123 1 ASI SF

BOOK.COPY -- NON-FICTION

BOOK I.D. BOOK COPY# DEWEY NUMBER AUTHOR ABBREVIATION
PK, FK PK, FK NN NN
234233 3 919.324 LOU
342344 2 119.606 MIL
993212 1 003.221 ERI

BOOK.COPY RECOVERY

BOOK I.D. BOOK COPY# DATE RECOVERY AUTHORIZED RECOVERY STATUS I.D.
PK, FK PK, FK   FK, NN
233311 2 98 08 11 TBB
992311 1   L
933321 3 99 01 11 C

BOOK.COPY RECOVERY HISTORY

BOOK I.D. BOOK COPY# DATE (YY MM DD) RECOVERY STATUS CODE
PK, FK PK, FK NN FK, NN
332211 3 98 12 01 L
332211 3 98 12 24 C
432432 1 98 11 14 TBB

BRANCH

BRANCH I.D. BRANCH NAME ADDRESS POSTAL CODE PHONE NUMBER FAX NUMBER EMPLOYEE # OF HEAD LIBRARIAN
PK, UA NN NN NN NN   FK, NN, ND
1 ANNETTE STREET 145 ANNETTE ST M4C 3A8 393 7692 393 7712 108
2 BEACHES 2161 QUEEN ST E M3C 2H1 393 7703 393 7704 99
3 BLOOR/GLADSTONE 1101 BLOOR ST W M4J 1A3 393 7674 393 1122 18

COPY STATUS

COPY STATUS CODE COPY STATUS NAME
PK, UA NN, ND
B BORROWED
DNC DOES NOT CIRCULATE
L LOST

EMPLOYEE

EMPLOYEE NUMBER EMPLOYEE POSITION I.D. BRANCH I.D. SUPERVISOR OF EMPLOYEE# PART / FULL-TIME SIN
PK, SA FK, NN FK, NN FK NN NN
221 32 2 92 FULL 382-119-444
108 16 12 9 PART 221-336-112
92 18 2 12 PART 992-222-222

EMPLOYEE (cont.)

START DATE
(YY MM DD)
END DATE
(YY MM DD)
HOME ADDRESS CITY PROVINCE POSTAL CODE AREA CODE PHONE NUMBER
NN   NN NN NN NN NN NN
99 02 11   219 MAIN ST TORONTO ON K1C 1M1 905 333 2211
96 03 12 98 12 22 18 RAILROAD ST MISSISSAUGA QC Q1Z 3C1 514 332 1919
92 08 11   1333 QUEEN ST E TORONTO ON M4C 1A8 416 482 1111

EMPLOYEE -- FULL-TIME

EMPLOYEE NUMBER MONTHLY SALARY FULL-TIME SINCE (YYMMDD)
PK, FK NN NN
183 2000 98 12 01
222 3000 97 12 24
165 4000 91 11 19

EMPLOYEE -- PART-TIME

EMPLOYEE NUMBER HOURLY WAGE PART-TIME SINCE (YYMMDD)
PK, FK NN NN
994 12.13 82 11 13
108 11.12 93 01 01
221 14.37 89 08 19

EMPLOYEE POSITION

EMPLOYEE POSITION I.D. EMPLOYEE POSITION NAME
PK, SA NN, ND
6 HEAD LIBRARIAN
12 CLERK
18 HEAD OF COLLECTION

LANGUAGE

LANGUAGE I.D. LANGUAGE NAME
PK, UA NN, ND
1 ENGLISH
2 FRENCH
3 SPANISH

LIBRARY SECTION

SECTION I.D. SECTION NAME
PK, UA NN, ND
CHI Children's
DET Detective
SF Science Fiction

PATRON

LIBRARY CARD NUMBER PATRON SURNAME PATRON GIVEN NAMES ADDRESS CITY PROVINCE POSTAL CODE HOME AREA CODE HOME PHONE
PK, SA NN   NN NN NN NN    
1233444567 MURDOCH RUPERT 12 MAIN ST TORONTO ON M3C 1H1 416  
1443335432 BOWLES SALLY 11 PAPE AVE TORONTO ON M2H 1Y2 416 223 1111
1889926789 HOLMES SHERLOCK 92 YONGE ST TORONTO ON M8N 1Y2 416 992 1083

PATRON (cont.)

BUSINESS AREA CODE BUSI-
NESS PHONE
PATRON TYPE PATRON STATUS REGISTRA-
TION/RENEWAL DATE
NEW/
RENEWAL
OVER-
DUE FINES
DAMAGE FINES TOTAL FINES
    FK, NN FK, NN NN NN     DD
416 323 3399 J A 98 08 11 NEW      
416   S A 98 12 22 RENEWAL   12.95 12.95
    R S 97 11 13 RENEWAL 381.11 94.13 425.24

PATRON/BOOK

BOOK I.D. LIBRARY CARD NUMBER REQUEST TYPE BRANCH ID. REQUESTED ON
PK, FK PK, FK NN FK, NN NN
432342 1123435678 HOLD 22 98 12 31
435603 1112225356 LOAN 11 99 02 01
223233 1322115567 HOLD 18 98 12 22

PATRON STATUS

PATRON STATUS CODE PATRON STATUS NAME
PK, UA NN, ND
A ACTIVE
I INACTIVE
S SUSPENDED

PATRON TYPE

PATRON TYPE CODE PATRON TYPE NAME PATRON DAILY FINE AMOUNT
(DOLLARS)
MAXIMUM ALLOWED FINES
(DOLLARS)
PK UA NN, ND NN NN
J JUVENILE 0.02 5.00
R REGULAR 0.15 20.00
S SENIOR 0.00 20.00

PURCHASE ORDER

PURCHASE ORDER NUMBER SUPPLIER I.D. DATE ORDERED ORDERED BY (EMPLOYEE I.D.) PURCHASE ORDER STATUS CODE
PK, SA FK NN FK, NN FK, NN.
3322119986 2211 99 01 11 233 O
8833224456 3322 98 12 31 234 P
8711223453 2211 99 02 01 211 NP

PURCHASE ORDER / AVAILABLE ITEM / BRANCH PURCHASE ORDER

PURCHASE ORDER NUMBER ITEM NUMBER BRANCH PURCHASE ORDER
PK, FK, FK1 PK, FK, FK1 PK, FK.
332211 22114477 332211
443323 43223445 324232
897932 23423244 234234

PURCHASE ORDER -- BRANCH

BRANCH PURCHASE ORDER NUMBER BRANCH I.D. APPROVED BY EMPLOYEE # REQUESTED ON QUANTITY UNIT PRICE
PK, SA FK, NN FK, NN NN NN NN
332211 21 22 99 01 11 2 32.14
324322 22 11 99 02 06 11 11.14
242342 12 11 99 01 08 3 2.34

PURCHASE ORDER STATUS

PURCHASE ORDER STATUS CODE PURCHASE ORDER STATUS NAME
PK, UA NN, ND
O ORDERED
U ARRIVED
D DELAYED

RECOVERY STATUS I.D.

RECOVERY STATUS CODE RECOVERY STATUS NAME INITIATED AFTER (DAYS)
PK, UA NN, ND  
O OVERDUE 14
C COLLECTION 91
TBB TAKEN BY BORROWER  

SUBJECT

SUBJECT I.D. SUBJECT NAME
PK, SA NN, ND
233322 GEOGRAPHY -- NORTH AMERICA
234322 CALCULUS -- HISTORY (1950- )
443233 MACRAME -- TECHNIQUES

SUBJECT / BOOK

BOOK I.D. SUBJECT I.D.
PK, FK PK, FK
239847 444332
239847 234324
233333 234324

SUPPLIER I.D.

SUPPLIER I.D. SUPPLIER NAME SUPPLIER ADDRESS SUPPLIER CITY SUPPLIER PROVINCE
PK, SA NN NN NN NN
443322 PENGUIN HWY 7 MISSISSAUGA ON
223444 BOOKS 'R' US 2300 YONGE ST TORONTO ON
112233 CHAPTERS 200 BLOOR W TORONTO ON

SUPPLIER I.D. (cont.)

SUPPLIER POSTAL CODE SUPPLIER AREA CODE SUPPLIER PHONE NUMBER SUPPLIER FAX AREA CODE SUPPLIER FAX PHONE NUMBER SUPPLIER TYPE CODE
NN NN NN     FK, NN
M3C 2R9 905 833 3333 905 833 4444 P
M4X 1H1 416 343 2222 416 343 3333 V
M3C 1Y1 416 222 1111 416 222 2222 V

SUPPLIER TYPE

SUPPLIER TYPE CODE SUPPLIER TYPE NAME
PK, UA NN, ND
P PUBLISHER
V VENDOR
A AGENT

SUPPLIER / PUBLISHER

SUPPLIER I.D. PUBLISHER ID OF SUPPLIER ID
PK, FK PK, FK
332 2211
4433 2211
4433 2222

TITLE

TITLE I.D. TITLE NAME
PK, SA NN
332211 APPLIED CRYPTOGRAPHY
222222 CALCULUS
324344 BLACK HOLES: THREAT OR MENACE?

TITLE / BOOK

BOOK I.D. TITLE I.D.
PK, FK PK, FK
32432 434322
32432 444333
24234 322222

Logo || Chinese Applet || Music Applet || Tim's Calculator || String List || Computer Projects

Go To Tim's Home Page

1