5. E-R to Relational Model Mapping
● Step 1: Strong Entities:
All the strong entities are mapped as Tables:
LIBRARY(Libname, Liblocation)
DOCUMENT (Document#, Title, Doctype, number_copies)
READER (Reader#, reader_name, readertype)
AUTHOR (Author#, authorname)
6. E-R to Relational Model Mapping
● Step 2: Weak Entities
Weak entities are mapped as tables with the key of the entities they depend on as part of their keys.
COPY (Document#, Copy#) Document# is the key of the strong entity (Document) copy depends on.
● Step 3: 1:N Relationships
HAS: Already mapped as part of the mapping of the weak entity COPY
CONTAINS: Mapped as a foreign key in COPY because COPY has a total participation in the
relationship.
COPY (Document#, Copy#, location, Libname)
7. E-R to Relational Model Mapping
● Step 4: M:N Relationships:
They are mapped as tables with a composite key (keys of the entities they connect)
Waits_for : WAITING_LIST(Reader#, Document#, date_available)
Writes: BOOK_AUTHOR (Author#, Document#)
8. E-R to Relational Model Mapping
● Step 5: Higher Order Relationships:
They are mapped as tables with a composite key (keys of the entities they connect)
- Borrows: DOCUMENTS_BORROWED (Reader#, Document#, Copy#, Libname, date_borrowed,
return_date)
- Returns: DOCUMENTS_RETURNED (Reader#, Document#, Copy#, Libname, date_returned)
- Lends: DOCUMENT_TO_LIBRARY(Document#, Copy#, Lending_libname, Borrowing_libname,
lend_date);
● Step 6: Multivalued Attibutes:
Mapped as tables the the key of the entity as a key of the table
Desc (Document #, descriptor)