Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write SQL queries in Mysql to perform the following operations. In each case show the SQL statement you used and the output from MySQL. The

Write SQL queries in Mysql to perform the following operations. In each case show the SQL statement you used and the output from MySQL.

The tables of Hospital database are as follows:

team (team_code, telephone_no, staff_no)

consists_of (staff_no, team_code)

doctor (staff_no, doctor_name, position)

specialist (staff_no, specialism)

patient (patient_id, patient_name, gender, height, weight, staff_no, ward_no)

ward (ward_no, ward_name, number_of_beds)

nurse (staff_no, nurse_name, ward_no)

supervises (staff_no, supervisor)

treatment (staff_no, patient_id, start_date, reason)

prescription (prescription_no, quantity, daily_dosage, staff_no, patient_id, start_date, drug_code)

small_occupied_by(patirnt_id, ward_no)

drug (drug_code, drug_name, type, price)

a) List prescription numbers and drugs whose codes are either P51 or X01 in these prescriptions.

b) Find the team codes along with staff numbers in each team.

c) Retrieve the staff numbers, patient identifiers and names along with starting date of all treatments that were between 2007-01-01 and 2007-02-01.

d) List the ward numbers and names along with patient identifiers and the number of patients in each ward. The output table should be sorted based on ward numbers in an ascending way.

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

1. Discuss the five types of learner outcomes.

Answered: 1 week ago