Question: Need assistance for this question, in SQL please Consider the following relational database scheme TREATMENT (disease, medication) PERSON (SSN, firstName, lastName, phone, email, address, city,

Need assistance for this question, in SQL please Consider the following relationalNeed assistance for this question, in SQL please

Consider the following relational database scheme TREATMENT (disease, medication) PERSON (SSN, firstName, lastName, phone, email, address, city, province) PATIENT (patient_id, SSN) DOCTOR (doctor id, SSN, disease of specialization) TREATED (doctor _id, patient_id, date, procedure, diagnostic) A patient may suffer from several diseases, and may take several medications for each disease. It is possible to a doctor to be a patient and vice-versa. The domains of the attributes "disease" and "disease-of-specialization" are the same, namely, the set of all diseases. In "treated" relation, the procedure could be consultation, or intervention (surgery etc.) and the diagnostic could be the name of a disease or the type of intervention Write each of the following queries in SQL(a to f 7 points & g 8 points): Give the detail (SSN, firstName, lastName, phone, email, address, city, province) of doctors who do not suffer from any disease a. b. List detail of patients (SSN, firstName, lastName, phone, email, address, city, province) who suffer from more than one disease c. Give the firstName, lastName and phone of doctors who are also patients suffering from a disease in their own specialization. Find diseases for which there is only one medication Find the firstName and lastName of patients who had an operation done by a doctor with d. e. HIV f. List all the pairs of patients having exactly the same diseases [i.e. all the pairs (fistNamel, lastNamel, firstName2, lastName2) such that firstName1, lastNamel and firstName2, lastName2 have exactly the same diseases] List the patients who consulted two or more doctors and was given exactly the same diagnosis. For these patients give their firstName, lastName, the firstName, lastName of the doctors and the date as well as the diagnosis g. Consider the following relational database scheme TREATMENT (disease, medication) PERSON (SSN, firstName, lastName, phone, email, address, city, province) PATIENT (patient_id, SSN) DOCTOR (doctor id, SSN, disease of specialization) TREATED (doctor _id, patient_id, date, procedure, diagnostic) A patient may suffer from several diseases, and may take several medications for each disease. It is possible to a doctor to be a patient and vice-versa. The domains of the attributes "disease" and "disease-of-specialization" are the same, namely, the set of all diseases. In "treated" relation, the procedure could be consultation, or intervention (surgery etc.) and the diagnostic could be the name of a disease or the type of intervention Write each of the following queries in SQL(a to f 7 points & g 8 points): Give the detail (SSN, firstName, lastName, phone, email, address, city, province) of doctors who do not suffer from any disease a. b. List detail of patients (SSN, firstName, lastName, phone, email, address, city, province) who suffer from more than one disease c. Give the firstName, lastName and phone of doctors who are also patients suffering from a disease in their own specialization. Find diseases for which there is only one medication Find the firstName and lastName of patients who had an operation done by a doctor with d. e. HIV f. List all the pairs of patients having exactly the same diseases [i.e. all the pairs (fistNamel, lastNamel, firstName2, lastName2) such that firstName1, lastNamel and firstName2, lastName2 have exactly the same diseases] List the patients who consulted two or more doctors and was given exactly the same diagnosis. For these patients give their firstName, lastName, the firstName, lastName of the doctors and the date as well as the diagnosis g

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!