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

Assignment 01

This document contains an assignment for a computer engineering class involving database design. It provides requirements for designing a database to track information for patients, doctors, drugs, pharmacies, and their relationships. It includes 6 questions: 1) design an ERD and convert to tables for the pharmacy database scenario, 2) define what a query language is and compare procedural vs non-procedural, 3) design a nested attribute to track a student's previous college education, 4) draw ERDs showing cardinality for relationships between doctors/patients, hospitals/rooms, and authors/books, 5) write relational algebra queries on a database of sailors, boats, and reservations.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Assignment 01

This document contains an assignment for a computer engineering class involving database design. It provides requirements for designing a database to track information for patients, doctors, drugs, pharmacies, and their relationships. It includes 6 questions: 1) design an ERD and convert to tables for the pharmacy database scenario, 2) define what a query language is and compare procedural vs non-procedural, 3) design a nested attribute to track a student's previous college education, 4) draw ERDs showing cardinality for relationships between doctors/patients, hospitals/rooms, and authors/books, 5) write relational algebra queries on a database of sailors, boats, and reservations.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

AGNEL INSTITUTE OF TECHNOLOGY AND DESIGN

COMPUTER ENGINEERING DEPARTMENT

ASSIGNMENT 01

SUB: DMQP CLASS: TE COMP (Sem V)

Notification Date: 29/08/2022


Submission Date: 20/09/2022

1 List the advantages and disadvantages of hierarchical data model, network data
model and Object-oriented data model.
2 The Prescriptions-R-X chain of pharmacies has offered to give you and your two
neighbors a free lifetime supply of medicine if you design its database. Given the
rising cost of health care, you agree. Here are the requirements.
Requirements:
• Patients are identified by an SSN, and their names, addresses, and ages must be
recorded.
• Doctors are identified by an SSN. For each doctor, the name, specialty, and years of
experience must be recorded.
• Each pharmaceutical company is identified by name and has a phone number.
• 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.
• Each pharmacy has a name, address, and phone number.
• Every patient has a primary physician. Every doctor has at least one patient.
• 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.
• 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.
• Pharmaceutical companies have long-term contracts with pharmacies. A
pharmaceutical company can contract with several pharmacies, and a pharmacy can
contract with several pharmaceutical companies. For each contract, you have to
store a start date, an end date, and the text of the contract.
• Pharmacies appoint a supervisor for each contract. There must always be a
supervisor for each contract, but the contract supervisor can change over the lifetime
of the contract.
1) Draw an E-R diagram that represent the database scenario. Include an
indication of the cardinality of relationships and specify any mandatory
relationship (total participation). State any assumptions that you make.
2) Convert the E-R diagram to tables, using schema statements
3. What is a query language? What is the difference between procedural and non-
procedural query language? Is SQL a procedural or non-procedural language?
4. Composite and multivalued attributes can be nested to any number of levels.
Suppose we want to design an attribute for a STUDENT entity type to keep track of
previous collage education. Such an attribute will have one entry for each college
previously attended, and each such entry will be composed of college name, start and
end dates, degree entries (degrees awarded at that college, if any), and transcript
entries (courses completed at that college, if any). Each degree entry contains the
degree name and the month and year the degree was awarded, and each transcript
entry contains a course name, semester, year, and grade. Design an attribute to hold
this information.
5. For each of the following pairs of rules, draw an ER diagram showing the cardinality
and participation constraints:

• A doctor may treat many patients. A patient may have a designated doctor for
different types of problems
• A hospital has many patient rooms. Each patient room belongs to that hospital.
• An author may write many books. A book may be written by more than one author

6. Consider the following employee database:


Reserves (sid,bid,day)
Boats(bid,bname,color)
Sailors(sid,sname,rating,age)

Specify a relational algebra expression for each of the following queries:


a) To print names and ages of all sailors:
b) Print all fields for sailors with rating > 8
c) Find names of sailors who have reserved boat #103
d) Find names of sailors who have reserved a red boat
e) Find the names of sailors who have reserved at least one boat
f) Find the sids of sailors with age over20 who have not reserved a red boat

You might also like