Practice of E-ERD Case Studies
Case study -1:
An international school of technology has hired you to create a database management
system to assist in scheduling classes. After several interviews with the president, you
have come up with the following list of entities, attributes, and initial business rules:
A room can be scheduled for one section or no section. A section can be scheduled in
one and only one Room. When class is scheduled in a room following information are
recorded Day of Week, Start Time and End Time. Room is identified by Room No and
also has an attribute Capacity. A room can be either a lab or a classroom. If it is a
classroom, it has an additional attribute called Board Type and if it is lab, it has an
attribute media type (such as a VCR, projector, etc.). A room cannot be both a
classroom and lab. There are also no other room types to be incorporated into the
system. Section has identifier Section ID and attribute Enrollment Limit. A lab has one
or more computers. Each type of computer belongs to one and only one lab. Computer
is identified by CID and has attributes Computer Type, Type Description, Disk
Capacity, and Processor Speed. An instructor can teach one or many sections and a
section is taught by exactly one instructor. Instructor has identifier Emp ID and has
attributes Name, Rank, and Office Phone. An Instructor may be Permanent instructor
or Visiting instructor. For Permanent Instructor salary is required to be stored but for
Visiting instructor hourly rate is required to be stored. An instructor may belong to
more than one category. There is no other category of instructor. Each Permanent
instructor supervises one or many students. There are some permanent instructors
which does not supervises any student. A student is supervised by one and only
permanent instructor. Attribute of student includes sid, name, gender, dob and contact.
A student may have multiple contacts. Each course generates zero, one or many
sections. And each section is generated by exactly one course. Course has identifier
Course ID and has attributes Course Description and Credits. Courses can have one,
none, or many prerequisites. Each course is prerequisite of zero, one or many courses.
Each student is assigned one or many projects and a project is assigned to exactly one
student. For project pid and ptitle is stored. A project can be software project or
survey project. For software project tools, technology is required to be stored and for
survey project survey minimum limit is required to be stored. A survey project has
one or many questions. And each question
may belong to one or many survey projects. For question question_number, question,
option 1, option 2, option 3 and option 4 is required to be stored.
Solution:
Case Study – 2:
Hospital has one or many employees, an employee works in one and only one hospital.
For employee eid, ename, edateofbirth, eaddress is required to be stored. Eid is used as
primary key. For hospital hospital_id (identifier), name of hospital, address and
contact number is required to be stored. A hospital may have more than one contact
numbers. Address of hospital is composed of city, street number and plot number. An
employee may be a doctor, a staff member or a nurse. For doctor specialization,
degree received is required to be stored. Each instance of employee belongs to exactly
one category. Employees are of exactly three types. For staff member rank and job
role is required to be stored. For nurse state license number is required to be stored. A
doctor treats one or many patients. A patient is treated by many doctors. There is no
patient that is not treated by any doctor. There is no doctor who has not treated any
patient yet. For patient pid, pname, paddress, pAge and pContact number is required
to be stored. Pid is used to identify individual instance of patient. Treatment details
are stored whenever a patient is treated by doctor. A patient may be an Outdoor
patient or Indoor patient. For outdoor patient checkbackdate is required to be stored
and for indoor patient discharge date is required to be stored. An indoor patient is
assigned exactly one bed. A bed is assigned to none or one indoor patient. For bed bed
number (identifier), bed location and per day charges are stored. Each indoor patient
is assigned one and only one nurse. A nurse may take care of one or many indoor
patients. Hospital has one or many pharmacies and a pharmacy belong to exactly one
hospital. A pharmacy contains one or many medicines and a medicine is found in
exactly one pharmacy. For pharmacy id, location, opening time and closing timing is
stored. Id is used to identify each instance of a pharmacy. Attributes of medicine are
mid, mtitle, batch number, manufacturing date, expiry date, generic and brand. Mid is
used to identify each medicine. Each patient purchase one or many medicines. A
medicine is purchased by zero, one or many patients. When medicine is purchased
purchase date, purchase time, medicine id and quantity is stored.
Solution:
Case Study-3:
A painter can paint one or more than one painting and each painting will be painted by
exactly one painter. There will be no painter who has not painted any painting yet. For
painter; pid (identifier) and pname is to be stored. Pname is further divided into two
components fname and lname. For painting; pnid (identifier) and title have to be
stored.Painting is further categorized into watercolour, oils and many others having
distinguished attributes x, y and other respectively. A single painting can belong to
multiple categorize. Each painting must be exhibited at exactly one gallery. There will
be no gallery without painting. For gallery; gid and location have to be stored where
gid is used as primary key. ExhibitionDate for each painting is also to be stored which
is neither attribute of painting nor gallery. Each gallery may be visited by many
customers and each customer may visit many galleries. There can be a gallery which is
not visited by any customer yet. There will be no customer who has not visited any
gallery yet. For customer; cid (identifier) and name have to be stored. A customer may
purchase zero,one or many paintings while each painting will be sale out to only one
customer. There can be some paintings which are not sold out to any customer. A
customer is further categorized in exactly two types; member and non-member. For
member customer; memno and for non-member; visitno have to be stored. A member
customer can never be a non-member and vice versa. Each gallery is managed by
exactly one manager but one manager can manage one or more than one gallery. For
manager, mid, name and contactno have to be stored. A manager can have multiple
contactno. Each gallery offers exactly two types of different promotions; first one is
Boomoffer having attributes offerId, offertitle, giftoffered, offerexpirydate, and
offerstartdateand second one is CoolOffer having attributes offered, offertitle,
offerdiscount, offerexpirydate, and offerstartdate. Member cutomer can avail both
offers and non-member customer can avail only Boomoffer. One customer can avail
exactly one offer and each offer can be availed by one, none or multiple customers.
Solution: