Lab Final Exam Section B: Instructions
Lab Final Exam Section B: Instructions
Spring 2016
Total Marks: 35
Run script file LabFinal.sql to create tables and populate data of a Hospital
management system.
dept is department id in Doctor table. Day_of_week is Monday, Tuesday etc.
Phone is mobile phone number of patient.
Question 1
Marks 5
Create a view to give the name(s) of the oldest patient(s) along with the total fees
that patient has paid so far.
Question 2
Marks 8+2
Find name of Very Special Patient/Patients of the year of any given doctor.
Note: A special patient is one who has only ever consulted with that doctor if
consulted ever.
Provide reason why you used View/Trigger/Stored Procedure or UDF for this.
1
Farrah Munir
CS Database Systems
Question 3
Spring 2016
Marks 5
Give the name/names of the highest earning doctor/doctors for every month of
each year.
Question 4
Notification (Patient_id ,Phone,
Doctor_id,AppointmentDate,StartTime,Timestamp)
Marks 10
Assume we have created an SQL Server job task that reads Notification table daily
at 8am and sends sms to patients about their due appointment on that day if any.
Implement logic to populate Notification table whenever an appointment is
scheduled.
Note: GetDate() in sql returns current timestamp.
Question 5
Marks 5
Write a function to find the name of immediate supervisor for any given doctor id.
2
Farrah Munir