Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Database Systems (SET11101)

Muhammad Najeeb | Database Systems (SET11101) | 26/10/2023

Tasks:

(A) create an entity-relationship diagram (ERD) for given scenario,

(B) create a corresponding relational scheme for your diagram, and verify it meets first, second and
third normal forms, then

(C) design test data that will let you run and test the listed queries

Table of Contents
Entity Relationship Diagram..........................................................................................2

Assumptions...........................................................................................................2

Relational Scheme..........................................................................................................3

Test Data........................................................................................................................3
TASK A: Entity-Relationship Diagram (ERD)

Assumptions made

 Each book has multiple copies, and copies have a one-to-many relationship with books.

 Members can borrow multiple copies, but they can only have one reservation per copy.

 A member can have multiple fines for late returns.


TASK B: Relational Scheme

Book: Book (PK BookID, Title, Author, ISBN, PublicationDate, Genre)

Copy: Copy (PK CopyID, Status, FK BookID)

Member: Member (PK MemberID, Name, ContactDetails)

Loan: Loan (PK LoanID, BorrowDate, ReturnDate, FK CopyID, FK MemberID)

Reservation: Reservation (PK ReservationID, FK CopyID, FK MemberID)

Fine: Fine (PK FineID, FineAmount, IsPaid, FK MemberID)

TASK C: Test Data

Book Table Sample Data

BookID Title Author ISBN PublicationDate Genre

1 Book A Author A ISBN-A-123 2022-01-01 Fiction

2 Book B Author B ISBN-B-456 2022-02-01 Non-Fiction

3 Book C Author A ISBN-A-123 2022-03-01 Fiction

4 Book D Author B ISBN-B-456 2023-02-01 Non-Fiction

5 Book E Author A ISBN-A-789 2022-03-01 Fiction

6 Book F Author A ISBN-A-012 2020-01-01 Fiction

7 Book G Author B ISBN-B-456 2021-02-01 Non-Fiction

8 Book H Author A ISBN-A-123 2022-03-01 Fiction

9 Book I Author B ISBN-B-456 2020-02-01 Non-Fiction

10 Book J Author A ISBN-C-876 2022-03-01 Fiction

Copy Table Sample Data

CopyID Status BookID

1 On Loan 1

2 On Loan 1

3 On Loan 2

4 On Loan 2
5 On Loan 3
6 On Loan 3
7 On Loan 4
8 On Loan 4
9 On Loan 5
10 On Loan 5

Member Table Sample Data

MemberID Name ContactDetails

1 Peters peters@gmail.com

2 Andrew andrew@gmail.com
3 Peters peters@gmail.com

4 Simon simon@gmail.com
5 Peters peters@gmail.com
6 Sohail sohail@gmail.com
7 Peters peters@gmail.com
8 Bilal bilal@gmail.com
9 John john@gmail.com
10 Irfan irfan@gmail.com

Loan Table Sample Data

LoanID BorrowDate ReturnDate CopyID MemberID

1 2022-03-01 2022-03-31 1 1

2 2022-03-01 2022-03-10 3 1

3 2022-03-01 2022-03-31 5 1

4 2022-03-01 2022-03-16 7 1
5 2022-03-01 2022-03-31 9 1
6 2023-07-05 2023-07-12 2 2
7 2022-03-01 2022-03-27 4 3
8 2023-04-01 2023-04-31 6 4
9 2023-08-01 2023-08-31 8 5
10 2023-09-01 2023-10-01 10 6

Reservation Table Sample Data

ReservationID CopyID MemberID

1 10 1

2 8 1

3 4 2
4 5 3
5 7 4

Fine Table Sample Data

FineID FineAmount IsPaid MemberID

1 16.00 0 1

2 3.00 1 3

3 5.00 1 4

4 5.00 0 5

5 5.00 1 6

You might also like