Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( please help me with this question quickly Database Systems: csci 335 waitting ) IV - SQL Queries : Consider the following Relational schema and

( please help me with this question quickly Database Systems: csci 335 waitting )

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

IV - SQL Queries : Consider the following Relational schema and Relations instances. (30 points) 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) Write SQL queries that will do the following Patient Prescription Patient.ID Medicine.code ID P..name City Clinic 112233445 Adam Beirut 112233445 Nx306 Well Nutrition 998877665 Bob Saida 112233445 Pa003 Healthy Clinic 556677889 Sara Zahle 998877665 Pa003 Safe Clinic 443322445 Eve Tyre 443322445 Ad500 Safe Clinic 443322445 Nx306 Well Nutrition Medicine code Mname Ingredients Price Pa003 Panadol Potassium, Paracetamol. Starch 5.5 Nx306 Nexume Magnesium, Polysorbate, Glyceryl 20.0 Ad500 Adol Acetaminophen, Paracetamol 3.0 Ap800 Aspirin Acetysalicylic Acid, Starch 8.55 List the name and the ID of all patients Your answer Find the names of patients who have at least one prescription. * Your answer Find the names of patients who have a prescription that contains the medicine called Panadol. * Your answer Find the average price of medicines * Your answer Find total price of medicines prescribed for a patient called Adam. * Your answer Your answer * Find the maximum price of a medicine Your answer Find the name of the medicine(s) that have the lowest price * Your answer Find the name(s) of patient(s) who have more than one prescription Your answer Find all the information about all medicines sorted in the ascending order of price. Your answer Find the name of all medicines that have an ingredient called "paracetamol'* Your answer Find the name of all patients whose ID ends with 445' * Your answer Add new medicine to the database * Your answer Change the price of 'Panadol medicine to 4 Your

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago