5CCS02DB Database SystemsLecturer: Sophia TsokaTeaching Assistants: Yiannis Siantos, Christos HadjinikolisOctomber 6, 2011 – 2nd Tutorial1 ExerciseDesign a Database for prescription monitoring based on the given data:• Patients are defined by an identity number, a name and a surname, and by a birth-date.• Doctors are defined as well by an identity number, a name, a surname, and a birth-date,while additionally they will be characterised by a work start date and a specialty.• Pharmaceutical companies will be defined by a name, and a telephone number.• Medicines will be defined by a commercial name, their manufacturer, and their activeingredient.• Pharmacies will be defined by a name, an address and a telephone number.Additionally you should take into account the following:• Each patient has one doctor• Each doctor has at least one patient• A doctor can prescribe certain medicines to his patients• Each pharmacy sells several medicines, each at a specific price• Each medicine can be sold by several pharmacies possibly at a different price• Pharmaceutical companies have contracts with pharmacies• Each pharmaceutical company may have contracts with several pharmacies• Each pharmacy may have contracts with several pharmaceutical companies• For each contract there is a start date, an end date and the contract contents.• For each contract there is always a person responsible for it, which may change at anypoint while the contract is still in effect.12 ExerciseConsider the following set of requirements for a university database that is used to keep track ofstudents’ transcripts.• The university keeps track of each student’s name, student number, social security number,current address and phone, permanent address and phone, birth date, sex, class (freshman,sophomore, ,.., graduate), major department, minor department (if any), and degree pro-gram (B.A., B.S., ..., Ph.D.). Some user applications need to refer to the city, state, andzip of the student’s permanent address, and to the student’s last name. Both social securitynumber and student number have unique values for each student.• Each department is described by a name, department code, office number, office phone,and college. Both name and code have unique values for each department.• Each course has a course name, description, course number, number of semester hours,level, and offering department. The value of course number is unique for each course.• Each section has an instructor, semester, year, course, and section number. The sectionnumber distinguishes different sections of the same course that are taught during the samesemester/year; its values are 1, 2, 3, ...; up to the number of sections taught during eachsemester.• A grade report has a student, section, letter grade, and numeric grade (0, 1, 2, 3, 4 for F, D,C, B, A, respectively).Design an ER schema for this application, and draw an ER diagram for that schema. Specifykey attributes of each entity type and structural constraints on each relationship type. Note anyunspecified requirements, and make appropriate assumptions to make the specification complete.2(1,N) (1,N) (0,N) (1,N) (0,N) Doctor Id name surname DOB Specialization Start Date Company Name Phone Medicine Name Act. Ingredient Has Contract Start Date End Date Content Responsible Perscription Sells Price (0,N) (1,1) (1,N) (1,N) Assumptions: - Each doctor will prescribe at least 1 medicine to some patient - While each pharmacy must sell at least one type of medicine it is not necessary for a medicine to have a pharmacy that sells it (thus the minimum of 0 in the relationship) - A company must have at least one contract with a pharmacy in order for it to be viable. A pharmacy must have at least 1 contract with a company in order to be able to sell medicine. - A medicines name uniquely identifies it due to the fact that it is required to be a registered trademark. Patient Id name surname DOB Pharmacy Name Phone Address Solution
View Full Document