0% found this document useful (0 votes)
2 views

Database 1

The document outlines a relational database schema for a library management system, detailing entities such as Employee, Library, Members, Book, Customer, Publisher, Payment, and their attributes. It describes the process of converting an Entity-Relationship (ER) diagram into a relational schema, including steps for mapping regular entities, weak entities, and various relationship types. Additionally, it discusses the logic governing the library system, such as borrowing rules, member identification, and book management.

Uploaded by

mekdeskefyalew77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Database 1

The document outlines a relational database schema for a library management system, detailing entities such as Employee, Library, Members, Book, Customer, Publisher, Payment, and their attributes. It describes the process of converting an Entity-Relationship (ER) diagram into a relational schema, including steps for mapping regular entities, weak entities, and various relationship types. Additionally, it discusses the logic governing the library system, such as borrowing rules, member identification, and book management.

Uploaded by

mekdeskefyalew77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

.

Relational database schema for Library


management system
EMPLOYEE
Date of bir Email Salary Employ_Id Name Library ID(FK)

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

Step 2: Mapping of Weak Entity Types


 For each weak entity type W in the ER schema with owner entity type E,
create a relation R and include all simple attributes of W as attributes of R.
 Include as foreign key attributes of R, the primary key attribute(s) of the
relation(s) that correspond to the owner entity type(s)
 For each weak entity type W in the ER schema with owner entity type E,
create a relation R and include all simple attributes of W as attributes of R.
 Include as foreign key attributes of R, the primary key attribute(s) of the
relation(s) that correspond to the owner entity type(s)
MEMEBERS
Mem department Fullname No of ISBN_numb Expire
inde book (FK) Date
allow

Step 3: Mapping of Binary 1:1 Relationship Types


 In the thrid step of mapping which has three components we choose the
first approch because it is the best option to work and it is suitabke for our
ER diagram of library management system.
Foreign key approach:
 For each weak entity type W in the ER schema with owner entity type
E, create a relation R and include all simple attributes of W as
attributes of R.
 Include as foreign key attributes of R, the primary key attribute(s) of
the relation(s) that correspond to the owner entity type(s)

 Relation between PAYMENT and BOOK (FOR relation)


PAYMENT
Transaction_Id Amount ISBN_number(FK)

Step 4: Mapping of Binary 1:N Relationship Types


 Identify the relation S that represents the participating entity type at the N-
side of the relationship type.
 Include as foreign key in S the primary key of the relation T that represents
the other entity type participating in R
 Include any simple attributes (or simple components of composite
attributes) of the 1:N relationship type as attributes of S.
Relationship types MAKES,RENT,CARRY,REFERENCE
CUSTOMER REFERENCE

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)

Step 5: Mapping of Binary M:N Relationship Types


 For each binary M:N relationship type R, create a new relation S to
represent R.
 Include as foreign key attributes in S the primary keys of the relations that
represent the participating entity types;
 their combination will form the primary key of S.
 Also include any simple attributes of the M:N relationship type as attributes
of S.
WRITTEN_BY relation from Author
ISBN_number Author_id
From Book

Step 6: Mapping of Multivalued Attributes


 For each multivalued attribute A, create a new relation R.
 This relation R will include an attribute corresponding to A, plus the
primary key attribute K—as a foreign key in R—of the relation that
represents the entity type or relationship type that has A as a
multivalued attribute.
 The primary key of R is the combination of A and K.
 If the multivalued attribute is composite, we include its simple
components.
Contact and phone number represents the multivalued attribute of CUSTOMER
and EMPLOYEE respectively.
CUSTOM_CONTACT

Cust_Id Cust_contact

EMP_phone no

E_Id E_phone num


Step 7: Mapping of N-ary Relationship Types
 In this step each R in the relation has a N-ary relation so in our
case we don’t have such kind of relation in this librar
management system enhanced enetity relation diagrm sample.
Step 8: for Mapping Specialization or generalization
8.1 ) Option A: Multiple relations—superclass and subclasses

 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

Entities and their Attributes

 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.

 Library Entity:-it has Library_id, name, novels, magazines, papers, comics,


location.

 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.

 Payment Entity:-it has transaction date, Amount.

THE LOGIC OR RULE OF THE LIBRARY MANAGEMENT SYSTEM

 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.

The Enhanced Entity-Relationship (EER) Model


The EER model includes all the modeling concepts of the ER model that were
presented.
CONVERSION OF ER DIAGRAM TO RELATIONAL SCHEMA

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy