0% found this document useful (0 votes)
16 views1 page

Scenario 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

Scenario 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Scenario 1: Hospital Management System

You are working as a database analyst for a hospital management system. The hospital database
includes multiple tables:

1. Patients (PatientID, Name, Age, Gender, BloodType, AdmissionDate, DischargeDate,


RoomNumber)
2. Doctors (DoctorID, DoctorName, Specialization, ConsultationFee)
3. Appointments (AppointmentID, PatientID, DoctorID, AppointmentDate, Diagnosis,
BillAmount)
4. Medications (MedicationID, PatientID, MedicationName, Dosage,
PrescriptionDate)

Using the above tables, answer the following questions:

1. Write a query to find the total BillAmount collected from appointments for each doctor,
showing only those doctors who have collected more than $10,000. Display columns
DoctorName and TotalBill. (Use JOIN, GROUP BY, HAVING).
2. Write a query to get a list of all patients who were admitted after January 1, 2024, and
were discharged within 10 days, displaying PatientID, Name, and RoomNumber. (Use
WHERE, DATEDIFF).
3. Fetch a list of all unique medications prescribed to patients above 60 years old and
having a blood type O+ or A+. (Use SELECT DISTINCT, WHERE, AND, IN).
4. Write a query to count the number of patients for each blood type who have been
admitted to Room 101, showing columns BloodType and PatientCount. (Use GROUP
BY, COUNT).
5. List all patients who have consulted with the doctor having DoctorName like 'Dr.
Smith%' and the consultation fee is either $500 or $700. Sort the result by
AppointmentDate in descending order. (Use LIKE, IN, ORDER BY).

You might also like