Assignment 3
Assignment 3
Database System
Assignment# 03
Program: BSCS Section: C
Instructions
Assignment should be hand-written.
All the questions are to be attempted on A4 blank pages. You are required to submit this
assignment in hard form. Questions not done on A4 blank pages will not be considered.
Keep the questions in order. Not following the proper order will result in marks deduction.
Plagiarism will not be tolerated, either done from the internet or from any fellow classmate
and will lead to zero or negative marks in the assignment.
Due Date of this assignment is 18 November 2024. Assignment is to be submitted in the
lecture. No late submissions will be accepted.
Although you always wanted to be an artist, you ended up being an expert on databases because
you love to cook data and you somehow confused database with database. Your old love is still
there, however so you set up a database company, Art Base that builds a product for art galleries.
The core of this product is a database with a schema that captures all the information that galleries
need to maintain.
Galleries keep information about artists, their names (which are unique), birthplaces, age
and style of art.
For each piece of artwork, the artist, the year it was made, its unique title, its type of art
(e.g., painting, lithograph, sculpture, photograph), and its price must be stored.
Pieces of artwork are also classified into groups of various kinds, for example, portraits
still life’s, works by Picasso, or works of the 19th century; a given piece may belong to
more than one group.
Each group is identified by a name (like those just given) that describes the group.
Finally, galleries keep information about customers. For each customer, galleries keep that
person’s unique name, address, total amount of dollars spent in the gallery (very
important!), and the artists and groups of art that the customer tends to like.
b) Draw an ER diagram for the following scenario:
The Prescriptions-R-X chain of pharmacies has offered to give you a free life-time supply of
medicines if you design its database. Given the rising cost of health care, you agree. Here is the
information that you gather.1. Patients are identified by SSN, and their names, addresses, and also
ages.
2. Doctors are identified by an SSN, for each doctor, the name, specialty and years of experience
must be recorded.
3. Each pharmaceutical company is identified by name and has a phone number.
4. For each drug, the trade name and formula must be recorded. Each drug is sold by a given
pharmaceutical company, and the trade name identifies a drug uniquely from among the products
of that company. If a pharmaceutical company is deleted, you need not keep track of its products
any longer.
5. Each pharmacy has a name, address, and phone number.
6. Every patient has a primary physician. Every doctor has at least one patient.
7. Each pharmacy sells several drugs and has a price for each. A drug could be sold at several
pharmacies, and the price could vary from one pharmacy to another.
8. Doctors prescribe drugs for patients. A doctor could prescribe one or more drugs for several
patients, and a patient could obtain prescriptions from several doctors. Each prescription has a date
and a quantity associated with it. You can assume that if a doctor prescribes the same drug for the
same patient more than once, only the last such prescription needs to be stored.
9.Pharmaceutical company have long-term contracts with pharmacies. A pharmaceutical company
can contract with several pharmaceutical companies. For each contract, you have to store a start
date, and end date, and the text of the contract.
10. Pharmacies appoint a supervisor for each contract. There must always a supervisor for each
contract.
Tasks:1. Draw a ER diagram that captures the above information. Identify and constraints that are
not captured by your ER-diagram.
2. How would your design change if each drug must be sold at a fixed price by all the pharmacies?
3. How would your design change if the design requirements change as follows: If a doctor
prescribes the same drug for the same patient more than once, several such prescriptions may have
to be stored separately?
A university wants to set up a database to record details about its staff, and the departments
they belong to. They intend to record the following information.
For each member of staff, their staff identity number, name, job title, and salary.
For each department, its name and address.
For each member of staff, all departments that they belong to. It is required that every member
of staff belongs to at least one department.
For each department, the head of department. It is required that each department has exactly one
head of department. Draw an ER diagram that expresses the requirements for the database. Make
sure that you capture all the constraints on the data mentioned above.