Question: I'm having problems in giving the solutions (1,2,3) in Relational Algebra 4. For each side effect (symptom), list the patient who most recently developed that

I'm having problems in giving the solutions (1,2,3) in Relational Algebra

I'm having problems in giving the solutions (1,2,3) in Relational Algebra 4.

4. For each side effect (symptom), list the patient who most recently developed that side effect. (In case of ties, list all patients who developed that symptom on that day.)

*DO NOT USE MAX

We have the information about patients in a database with the following schema: Prescription (PatientID, Drug, Start, End, Physician, Diagnosis), and NewSymptom (PatientID, Diagnosis, Start, End). Some Clarifications: In Prescription, Start is the date the patient started taking the drug, and End is the last date the patient took the drug. To simplify the query, assume that no dates are missing. Physician is the physician who prescribed the drug, and Diagnosis is the condition for which the physician prescribed it. (Assume that, although a drug may be prescribed for multiple conditions, when a physician prescribes a drug for a patient (s)he prescribes it because of a single condition.) NewSymptom stores problems that patients have developed that apparently might be side effects of medications. Diagnosis is the physician's description of the apparent side effect. Start and End are the starting and ending dates of the symptom. Again, assume End is never blank. Assume dates are stored as integers, so that larger integers correspond to later dates. (One common way is what's called a Julian Date (nothing to do with Julius Caesar], where we might store today's date as 2012094 - today is the 94th day of 2012. But all you need care about is that the dates are in the right order.) Write the following queries in relational algebra: List all Physicians whose prescriptions seem to have caused infracaninophilia: that is, look for cases where Physician X prescribed drug Y to patient Z, and Z developed infracaninophilia while taking Y. List all pairs (p1: p2) of patients where p1 has taken every medication that p2 has taken, but p2 has developed some side effect (diagnosis) that p1 has not developed. List all triples (Physician1, Physirian2. PatientID), where (the two Physicians are not the same and) both physicians have prescribed to the same patient at the same time. We have the information about patients in a database with the following schema: Prescription (PatientID, Drug, Start, End, Physician, Diagnosis), and NewSymptom (PatientID, Diagnosis, Start, End). Some Clarifications: In Prescription, Start is the date the patient started taking the drug, and End is the last date the patient took the drug. To simplify the query, assume that no dates are missing. Physician is the physician who prescribed the drug, and Diagnosis is the condition for which the physician prescribed it. (Assume that, although a drug may be prescribed for multiple conditions, when a physician prescribes a drug for a patient (s)he prescribes it because of a single condition.) NewSymptom stores problems that patients have developed that apparently might be side effects of medications. Diagnosis is the physician's description of the apparent side effect. Start and End are the starting and ending dates of the symptom. Again, assume End is never blank. Assume dates are stored as integers, so that larger integers correspond to later dates. (One common way is what's called a Julian Date (nothing to do with Julius Caesar], where we might store today's date as 2012094 - today is the 94th day of 2012. But all you need care about is that the dates are in the right order.) Write the following queries in relational algebra: List all Physicians whose prescriptions seem to have caused infracaninophilia: that is, look for cases where Physician X prescribed drug Y to patient Z, and Z developed infracaninophilia while taking Y. List all pairs (p1: p2) of patients where p1 has taken every medication that p2 has taken, but p2 has developed some side effect (diagnosis) that p1 has not developed. List all triples (Physician1, Physirian2. PatientID), where (the two Physicians are not the same and) both physicians have prescribed to the same patient at the same time

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!