Professional Documents
Culture Documents
Presentation
Presentation
1. For the first query I created it to count the total amount due for bills with
Patient Name. This is all the relevant codes to get the results we desired. To get
the total amount due we need to sum up all the bill and minus it with the total
payment paid. Since sum is a group function we will need to use the Group By.
2. 2nd query is display all the admited patients' full name , ward number and bed
number. This can be done by joining person table with consulatation then join it to
admission. This will link them together thus giving access to the patient's name,
bed_number and ward_number.
3. Now moving on to the stored procedure. The first one is to add specialist. To
make this work make sure they accepts these paramters and insert it into the person
table.
4. Then is the update_specialist procedure. This almost the same as before where we
make sure it accept these paramters, the difference is we can now input a number
infront of the details to indicate who we want to change, then it will update the
existing value.
5. This function calculates the total due for all persons. It starts by declaring
the variable total_due of type number. Then it performs a query that join person
table with bill on person_id and p_id. And finally sum the total bill amount.