Part 1 Use the following database to answer all questions in Part 1 PATIENT(PatientID, PatName, PatientDOB, PatientDiagnosis, PatientPhone, PatientReferID) THERAPIST(TherapistID, TherapistName, TherapistDegree, TherapistPhone) APPOINTMENT(AppointmentID, PatientID, TherapistID, AppointmentDate, AppointmentTime, Fee) EXERCISE(ExerciseID, ExerciseDescription, ExercisePicture) ASSIGNMENT(AppointmentID, ExerciseID, NumberOfReps) The primary key fields are underlined. PatientRefID is a foreign key value that matches a PatientID of another record in the table. Create a relational algebra queries to answer the following questions. Question 1 Write a query to display the names of all patients and the name of the referring patient. Question 2 Write a query to display, for all appointments on 10/8/2013, the name of the patient, the name of the therapist, and the appointment time. Question 3 Write a query to display the names and phone of all patients and therapists. Assume that no patient is also a therapist. There should be just two columns in this display. Question 4 Write a query to display the average fee paid for an appointment. Question 5 Write a query to display the number of appointments made by the patient with patientid 23. Question 6 Write a query to display the name of all therapists and the sum of all fees paid to that therapist. Question 7 Write a query to display the names of all patients born before 1950 with a diagnosis of Back Pain. Question 8 Write a query to display, for all exercise assignments for the patient with patid 23, the appointment date, the therapist, the exercise description, and the number of reps.
Question 9 Write a query to print the names of all therapists who have never treated a patient with a diagnosis of Back Pain. Question 10 Write a query to print the names of all patients who have made an appointment with every therapist.
Part 2 Convert the following ER diagram into a set of tables. EmergContact mentors Responsible PersonID name cellphone homephone w orkphone C Parent Employee employeeid name phone pay parent_of assigned ChildID DOB Name supervises Child has Allergy Substance Severity participates FieldTrip fieldtripid cost date does on Activity ActivityID description timeframe cost per activity availability email taken for Medication MedName Dosage DeliveryMethod emergency for relationship distance from
Part 3 Start with the following ER diagram: Book BookID Price Title Author Publisher buys Customer CustomerID Name email Modify it to create a new EER diagram. Assume that the following must be represented: A Book could be a Textbook or a Fiction Book. It could be both. It could be neither. Textbooks have a subject area. Fiction Books have a time period and a locale. Customers could be students or faculty. A customer could be someone other than a student or a faculty member. A customer cannot be both student and faculty. Faculty members have an office, an office phone, and a department. Students have a major. Students can be further classified into GraduateStudents and UndergraduateStudents. No student is both undergraduate and graduate. All students are one of these. Undergraduate students have a class year. Graduate Students have a degree program and a finish date. Faculty can order textbooks to be used for their courses. A faculty member can order many textbooks, and a textbook can be ordered by many faculty. We keep track of the CourseID and the OrderDate for each order. Students can rent textbooks. A student can rent many textbooks, and a textbook can be rented by many students. For each textbook rental, we keep track of the RentalDate and the ReturnDate. Graduate students can mentor undergraduate students. An undergraduate student has just one mentor, but a graduate student can mentor many undergraduates. Any other assumptions you make, let me know.
Part 4 Make an ER diagram that could store information about programs offered by a nature education center, the children who enroll in the programs, and the volunteers who teach in the programs. For each program, we keep track of the program date, the start time, the program length, the title, a description, and the recommended age group. For each child, we keep track of the name, the birthdate, and the phone number. For each volunteer, we keep track of the name, the phone number, and the email. A volunteer can have many skills. For each skill, we keep track of the description of the skill and the degree of expertise. We keep track of which children who attend our programs are siblings. A child can have many siblings. We keep track of which children are enrolled in each program. A program can have many children enrolled in it, and a child can be enrolled in many programs. We keep track of the volunteers for each program. A program can have many volunteers, and a volunteer can participate in many programs. Each program must have exactly one head volunteer. A volunteer can be the head volunteer for many programs.