4. Find the names of patients who have a prescription that contains the medicine called Panadol. 5. Find the average price of medicines 6. Find total price of medicines prescribed for a patient called Adam. 7. Find the names of the patients who have prescriptions from the 'Well Nutrition' clinic

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
What is the solution for this question (using sql queries)
4. Find the names of patients who have a prescription that contains the medicine called Panadol.
5. Find the average price of medicines
6. Find total price of medicines prescribed for a patient called Adam.
7. Find the names of the patients who have prescriptions from the 'Well Nutrition' clinic
8. Find the maximum price of a medicine
Transcribed Image Text:4. Find the names of patients who have a prescription that contains the medicine called Panadol. 5. Find the average price of medicines 6. Find total price of medicines prescribed for a patient called Adam. 7. Find the names of the patients who have prescriptions from the 'Well Nutrition' clinic 8. Find the maximum price of a medicine
Problem 4: SQL Queries
Consider the following Relational schema and Relations instances.
Patient (ID:char(9), p_name:varchar(25), City: varchar(50))
Prescription (Patient_ID:char(9), Medicine_code:char(5), Clinic:varchar(25))
Medicine (code:char(5), m_name:varchar, Ingredients:varchar, Price:float )
Patient
Prescription
ID
P_name
City
Patient ID
Medicine code
Clinic
112233445
Adam
Beirut
112233445
Nx306
Well Nutrition
998877665
Bob
Saida
112233445
Pa003
Healthy Clinic
556677889
Sara
Zahle
998877665
Pa003
Safe Clinic
443322445
Eve
Туre
443322445
Ad500
Safe Clinic
443322445
Nx306
Well Nutrition
Medicine
code
M_name
Ingredients
Price
Pa003
Panadol
Potassium, Paracetamol, Starch
5.5
Nx306
Nexume
Magnesium, Polysorbate, Glyceryl
20.0
Ad500
Adol
Acetaminophen, Paracetamol
3.0
Aр800
Aspirin
Acetysalicylic Acid, Starch
8.55
Transcribed Image Text:Problem 4: SQL Queries Consider the following Relational schema and Relations instances. Patient (ID:char(9), p_name:varchar(25), City: varchar(50)) Prescription (Patient_ID:char(9), Medicine_code:char(5), Clinic:varchar(25)) Medicine (code:char(5), m_name:varchar, Ingredients:varchar, Price:float ) Patient Prescription ID P_name City Patient ID Medicine code Clinic 112233445 Adam Beirut 112233445 Nx306 Well Nutrition 998877665 Bob Saida 112233445 Pa003 Healthy Clinic 556677889 Sara Zahle 998877665 Pa003 Safe Clinic 443322445 Eve Туre 443322445 Ad500 Safe Clinic 443322445 Nx306 Well Nutrition Medicine code M_name Ingredients Price Pa003 Panadol Potassium, Paracetamol, Starch 5.5 Nx306 Nexume Magnesium, Polysorbate, Glyceryl 20.0 Ad500 Adol Acetaminophen, Paracetamol 3.0 Aр800 Aspirin Acetysalicylic Acid, Starch 8.55
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY