Assignment MS 601
Assignment MS 601
Submitted By
Student’s Name : Md. Ashikur Rahman
Student’s ID : 045-22-3-00-05-11-3-016
Program : M.Sc. in CSE
Batch : 29
Seme. Name & Year: Fall 2022
Submitted To
Rowjatul Zannat Eshita
Assistant Professor
Computer Science and Engineering Department
Royal University of Dhaka
A database management system (DBMS) is a software tool that enables users to manage a database
easily. It allows users to access and interact with the underlying data in the database. These actions can
range from simply querying data to defining database schemas that fundamentally affect the database
structure.
The objective of a database management system is to facilitate the creation of data structures and
relieve the programmer of the problems of setting up complicated files. Data base management systems
have developed from a concept of the data base as something distinct from the programs accessing it.
The typical database administrative tasks that can be performed using a DBMS include:
Configuring authentication and authorization. Easily configure user accounts, define access
policies, modify restrictions, and access scopes. These operations allow administrators to limit
access to underlying data, control user actions, and manage users in databases.
Providing data backups and snapshots. DBMS can simplify the backup process of databases by
providing a simpler and straightforward interface to manage backups and snapshots. They can
even move these backups to third-party locations such as cloud storage for safekeeping.
Performance tuning. DBMS can monitor the performance of databases using integrated tools
and enable users to tune databases by creating optimized indexes. It reduces I/O usage to
optimize SQL queries, enabling the best performance from the database.
Data recovery. In a recovery operation, DBMS provides a recovery platform with the necessary
tools to fully or partially restore databases to their previous state—effortlessly.
ER Diagram is known as Entity-Relationship Diagram, it is used to analyze the structure of the Database.
It shows relationships between entities and their attributes. An ER Model provides a means of
communication.
The Library Management System database keeps track of readers with the following considerations –
The system keeps track of the staff with a single point authentication system comprising login Id
and password.
Staff maintains the book catalog with its ISBN, Book title, price (in INR), category (novel, general,
story), edition, author Number and details.
A publisher has publisher Id, Year when the book was published, and name of the book.
Readers are registered with their user_id, email, name (first name, last name), Phone no
(multiple entries allowed), communication address. The staff keeps track of readers.
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.
Staff also generate reports that has readers id, registration no of report, book no and
return/issue info.
Book Entity: It has authno, isbn number, title, edition, category, price. ISBN is the Primary Key
for Book Entity.
Reader Entity: It has UserId, Email, address, phone no, name. Name is composite attribute of
firstname and lastname. Phone no is multi valued attribute. UserId is the Primary Key for
Readers entity.
Publisher Entity: It has PublisherId, Year of publication, name. PublisherID is the Primary Key.
Authentication System Entity: It has LoginId and password with LoginID as Primary Key.
Reports Entity: It has UserId, Reg_no, Book_no, Issue/Return date. Reg_no is the Primary Key of
reports entity.
Staff Entity: It has name and staff_id with staff_id as Primary Key.
Reserve/Return Relationship Set: It has three attributes: Reserve date, Due date, Return date.
A reader can reserve N books but one book can be reserved by only one reader. The relationship
1:N.
A publisher can publish many books but a book is published by only one publisher. The
relationship 1:N.
Staff keeps track of readers. The relationship is M:N.
Staff maintains multiple reports. The relationship 1:N.
Staff maintains multiple Books. The relationship 1:N.
Authentication system provides login to multiple staffs. The relation is 1:N.
Question 3:
a. Find the highest purchase amount ordered by each customer on a particular date with their
ID, order date and highest purchase amount.
b. Find the name and city of those customers and salesmen who lives in the same city.
c. Find the names of all customers along with the salesmen who works for them.
d. Display all the orders issued by the salesman 'Paul Adam' from the orders table.
e. Extract the data from the orders table for the salesman who earned the maximum
commission.
Answer:
a.
SELECT customer_id,order_date,MAX(purch_amt)
FROM order
GROUP BY customer_id,order_date;
b.
d.
SELECT *
FROM order
WHERE salesman_id =
(SELECT salesman_id
FROM salesman
WHERE name='Paul Adam');
e.