3 Solution
3 Solution
URN: 2023-B-04072004
Semester: III
Program: BCA
Web
Here’s a sample database schema for a Library Management System. It includes tables, columns,
data types, and relationships between them using primary and foreign keys.
1. Member Table
VARCHAR(25
Name NOT NULL Name of the member
5)
2. Book Table
VARCHAR(25
Title NOT NULL Title of the book
5)
VARCHAR(25
Author NOT NULL Author of the book
5)
VARCHAR(10
Genre Genre of the book
0)
3. Staff Table
This table stores information about the library staff.
Column
Data Type Constraints Description
Name
VARCHAR(25
Name NOT NULL Name of the staff member
5)
VARCHAR(10
Position Position of the staff member
0)
VARCHAR(25
ContactInfo Contact information of the staff
5)
4. Publisher Table
Column
Data Type Constraints Description
Name
VARCHAR(25
Name NOT NULL Name of the publisher
5)
5. BorrowingTransaction Table
This table records the borrowing transactions where members check out books.
Column
Data Type Constraints Description
Name
, 2) any)
o Each table has a primary key (e.g., MemberID, BookID, PublisherID, StaffID,
TransactionID).
Relationships:
1. One-to-Many (1:M):
o A Publisher can have many Books (one publisher can publish many books).
o A Member can borrow many Books (one member can borrow multiple books over
time).
o A Staff can assist with many BorrowingTransactions (one staff member can manage
many borrowing transactions).
2. Many-to-Many (M:M):
o Members can borrow Books many times, and Books can be borrowed by many
Members. This relationship is handled by the BorrowingTransaction table.
Copy code
Address TEXT,
ContactInfo VARCHAR(255)
);
Genre VARCHAR(100),
PublishedYear YEAR,
PublisherID INT,
);
PhoneNumber VARCHAR(15),
);
Position VARCHAR(100),
ContactInfo VARCHAR(255)
);
ReturnDate DATE,
MemberID INT,
BookID INT,
StaffID INT,
);
Conclusion
This schema provides a well-organized structure for a Library Management System with tables,
columns, data types, and relationships. It ensures data integrity through the use of primary and
foreign keys, and it accommodates essential library functionalities like managing books, members,
borrowing transactions, and staff interactions.