Database 1
Database 1
LIBRARY
Library ID Name Novels Magazines papers comics Location
MEMEBERS
Department Member index Firstname Lastname No of Expire
books Date
allow
BOOK
ISBNno author price edition Library No of copy Publisher Fname Lname
ID(FK) ID(FK)
CUSTOMER
Customer ID Fname Lname Date of birth Firstname Lastname
PUBLISH
Publisher ID name Year of publication Address
PAYMENT
Transaction ID Amount
PERSON
Person_Id Detail
PUBLISHED BY
ISBN_number(FK) Publisher_Id(FK)
STUDENT
Student_Id Student name
TEACHER
Teacher_Id Teacher name
OTHERS
Other’s_Id Other’s name
AUTHOR
Author_Id Author name Email Website
WRITTEN_BY
ISBN_number (FK) Author_Id (FK)
EMPLOYEE_CONTACT
Phone number
CUSTOMER_CONTACT
Contact (FK)
ER to Relational Mapping
Step 1: Mapping of Regular Entity Types
For each regular (strong) entity type E in the ER schema, create a
relation R that includes all the simple attributes of E.
Include only the simple component attributes of a composite
attribute.
Choose one of the key attributes of E as the primary key for R.
If the chosen key of E is a composite, then the set of simple attributes
that form it will together form the primary key of R.
CUSTOMER
Customer ID FName LName Date of birth
EMPLOYEE
Date of Birth Email Salary Employee ID Name
LIBRARY
Library ID Name Novels Magazines papers Comics Location
BOOK
ISBN number price catagory Edition No of copies
PUBLISH
Publisher ID name Year of publication Addres
PAYMENT
Transaction ID Amount
AUTHOR
Author_id Author name Email Web site
CUSTOMER
ISBN no price catag edition Copies Issue_day Lib_Id Customer_id Refer_no Quantity Due
Date
PAYMENT MAKES
Transaction_Id Amount Customer_id(FK)
Cust_Id Cust_contact
EMP_phone no
Create a relation L for C with attributes Attrs(L) = {k, a1, ..., an} and PK(L)
= k.
Create a relation Li for each subclass Si, 1 ≤ i ≤ m, with the attributes
Attrs(Li) = {k} ∪ attributes of Si} and PK(Li) = k.
This option works for any specialization (total or partial, disjoint or
overlapping).
CUSTOMER (Disjoint)
Customer_Id Fname Lname Date of Birth
STUDENT
Customer_Id(FK) Student_Id Student name
TEACHER
Customer_Id(FK) Teacher_Id Teacher name
OTHER
Customer_Id(FK) Other’s_Id Other’s name
8.2) Option 8: Single relation with multiple type attributes.
Each ti, 1 ≤ i ≤ m, is a Boolean type attribute indicating whether a tuple
belongs to subclass Si.
This option is used for a specialization whose subclasses are overlapping
(but will also work for a disjoint specialization).
PERSON
Person_id Detail Cflag Cust ID FName LName DOB Eflag DOB Email Salary Name
Book Entity : It has auth no, ISBN_ number, title, edition, category, price.
ISBN is the Primary Key for Book Entity.
customer Entity : It has User Id, Email, address, phone no, name. Name is
composite attribute of first name and last name. contact is multi valued
attribute. Customer_id is the Primary Key for Readers entity.
Publisher Entity : It has Publisher Id, Year of publication, name. Publisher
ID is the Primary Key.
Member Entity:-it has department, Member index, first name, last name,
numbe of book allowed, member_id, Expire Date.
Employee Entity:- it has Date of birth, Email, Salary, Employee _id, name.
A single student can borrow or subscribe to multiple books, which means a one-to-many
relation needs to exist between both these entities.
A student can later become a member once they have paid a fee, so there should be space
in the ER diagram for up-gradation between these entities.
It would be best if we are varying that every book in the library is identified with a
different ID. This means we need to create a different book identification so book entity
has different id number.
In a library, multiple members or students enroll themselves. These require a unique ID
to identify them properly so we have a member and student identification for both.
When issuing books, there needs to be a due date set in place to return that book, which
requires another addition in the ER Diagram.
The customer who use the library can be any one like the students , the teachers and
other’s. we can conclude that every reader who wants to use the library book need to
have an identification card .
Readers can return/reserve books that stamps with issue date and return
date. If not returned within the prescribed time period, it may have a due
date too.
There could be more than one copy of a book and library members should be able to
check-out and reserve any copy but we call each copy by book like book item which is
found in book entity.
There is number of book allowed to take. In our library management system we assumed
that library is limited to give books if the customer takes the book to home and the must
not be able to borrow other book until they returned the first book so that there is a
relation between members and book.
We also allowed the publisher to publish many book and also we thought that many
books like reference books are one can be published by different publisher and different
author by integrated work can publish a book in this case the author and publisher has
many to many relation with book.