You are on page 1of 2

Department of IT & Computer Science

Pak-Austria Fachhochschule: Institute of Applied Sciences


and Technology, Haripur
Spring 2024
Course Title Database Systems Course Code COMP-231
Course Instructor Maria Gul Program BS(CS, & BIF), BS(SE)
Class
IInstInstructor/s: CS-S23 & B(BIF-F22), SE-F22 Semester
Name 3rd & 4th
Submission Date April 3, 2024 Maximum 25
Marks:

Instructions:
1. Only submissions on MS Teams are acceptable in PDF Format.
2. Five Marks will be deducted from late submission (1 Mark per day, max 5). More
than 7 days late submission will not be considered, and submission will be locked on
MS Teams.
3. For full marks, provide commented stepwise solutions to all the questions.
4. Rename the file as: Intake, Registration ID and Full Name (otherwise 3 Marks will
be deducted) e.g., SE22F_Inshira_Hassan_B22F0064SE112.pdf
5. In case of MS Teams problem, submit by email to:
maria.gul@adjunct.paf-iast.edu.pk
Q1: [5 Marks ]
Each publisher has a unique name; a mailing address and telephone number are also kept on
each publisher. A publisher publishes one or more books; a book is published by exactly one
publisher. A book is identified by its ISBN, and other attributes are title, price, and number of
pages. Each book is written by one or more authors; an author writes one or more books,
potentially for different publishers. Each author is uniquely described by an author ID, and we
know each author’s name and address. Each author is paid a certain royalty rate on each book
he or she authors, which potentially varies for each book and for each author. An author
receives a separate royalty check for each book he or she writes. Each check is identified by
its check number, and we also keep track of the date and amount of each check.
As you develop the ERD for this problem, follow good data naming guidelines.
Q2: [5 Marks]
A weak entity set can always be made into a strong entity set by adding to its attributes the
primary-key attributes of its identifying entity set. Outline what sort of redundancy will
result if we do so.
Q3: [5 Marks]
A library can have different types of books, and each book can have multiple copies. Each
copy in a library (belonging to some book type) has a unique ID.
To borrow a book from the library, one must be the member of the library. Once a person is
issued with books copies, record is maintained in database about the details of the person
and the copies borrowed by him, e.g., some of the basic fields could be personid, copyid,
borrowdate, returndate, persontype. A person may be a student or a teacher.

1
The library staff can access the library database using their user id and password. A staff
member can insert the record of newly purchased books copies in the library. The record
may include basic details like seller, publisher, cost, number of copies purchased, purchase
date, record entered by, etc.

WRITE THE FOLLOWNG QUERIES


(a) select details of copies for a given book type
(b) select details of book types.
(c) select details of copies issued by a given member.
(d) select details of copies whose return date is overdue (hint: match due date with current
date).
(e) select details of copies that are processed by a given library staff member with some
name. (use like to match name).
Q4: [5 Marks]
A hospital has a large number of registered physicians. Attributes of PHYSICIAN include
Physician ID (the identifier) and Specialty. Patients are admitted to the hospital by physicians.
Attributes of PATIENT include Patient ID (the identifier) and Patient Name. Any patient who
is admitted must have exactly one admitting physician. A physician may optionally admit any
number of patients. Once admitted, a given patient must be treated by at least one physician.
A particular physician may treat any number of patients, or may not treat any patients.
Whenever a patient is treated by a physician, the hospital wishes to record the details of the
treatment (Treatment Detail). Components of Treatment Detail include Date, Time, and
Results. Draw the ERD and answer the following questions:
(i) Did you draw more than one relationship between physician and patient? Why or why
not?
(ii) Did you include hospital as an entity type? Why or why not?
(iii) Does your ERD allow for the same patient to be admitted by different physicians over
time?

How would you include on the ERD the need to represent the date on which a patient is
admitted for each time they are admitted?
Q5. [10 Marks]
For the following ERD, draw the tables on paper with proper links showing between foreign keys and
primary keys.

You might also like