########################################## # # MySQL (2) : In class exercise # # Use the sample database (sample_data.sql) # if you are required to use a database # ########################################## ###### Question No. 1 ################################################## #################################################### # # Show patients P_id, P_FirstName, P_LastName, and City_ID # for those whose City_id is 4 # (hint: use pat_info; expect 3 rows) # #################################################### ###### Question No. 2 ################################################## #################################################### # # Show all patients with their city information # (hint: use pat_info, city_info; expect 50 rows) # #################################################### ###### Question No. 3 ################################################## #################################################### # # Show the Patient's P_id, P_FirstName, P_LastName, and City_Name # for those whose City_Name is 'Halifax' # (hint: use pat_info, city_info; expect 15 rows) # #################################################### ###### Question No. 4 ################################################## #################################################### # # Show patients P_id, P_FirstName, P_LastName, and City_Name # for those whose first name contains the letter 'j' # and live in 'Toronto' # (hint: use pat_info; expect 1 row) # #################################################### ###### Question No. 5 ################################################## #################################################### # # Show the number of patients who reside in 'Halifax' # (hint: use pat_info, city_info; expect 1 row) # #################################################### ###### Question No. 6 ################################################## #################################################### # # Show the Patient's P_id, P_FirstName, P_LastName and # their related Doctor's D_id, D_FirstName and D_LastName # for all of the patients # (hint: use pat_info, doc_info, pat_doc_relate; expect 80 rows) # #################################################### ###### Question No. 7 ################################################## #################################################### # # Show the Patient's P_id, P_FirstName, P_LastName and # their related Doctor's D_id, D_FirstName and D_LastName for # all of the patients who their P_FirstName starts with 'P' # (hint: use pat_info, doc_info, pat_doc_relate; expect 6 rows) # #################################################### ###### Question No. 8 ################################################## #################################################### # # Show 'Peter Johnsons' P_id, P_FirstName, P_LastName and # the number of doctors he has. # (hint: use pat_info, pat_doc_relate; expect 1 row) # #################################################### ###### Question No. 9 ################################################## #################################################### # # Show everything (Patient Information and Lab # Information) from those patients who have lab tests # (hint: use pat_info, lab_info; expect 29 rows) # #################################################### ###### Question No. 10 ################################################## #################################################### # # Show all patients and their lab results (if available) # (hint: use pat_info, lab_info; expect 69 rows) # #################################################### ###### Question No. 11 ################################################## #################################################### # # Show the patient's P_id, P_FirstName, P_LastName and # thier maximum RBC and WBC for all patients # (hint: use pat_info, lab_info; expect 10 rows) # #################################################### ###### Question No. 12 ################################################## #################################################### # # Show the Patient's P_id, P_FirstName, P_LastName, # rounded (2 decimal) average RBC and WBC, # rounded (0 decimal) average PLT # for the patients who have a lab test available # (hint: use pat_info, lab_info; expect 10 rows) # #################################################### ###### Question No. 13 ################################################## #################################################### # # Show the patient's P_id, P_FirstName, P_LastName and # his/her rounded (2 decimal) average RBC and WBC # while the Patient's P_FirstName is 'Peter' and his # P_LastName is 'Johnsons' # (hint: use pat_info, lab_info; expect 1 row) # #################################################### ###### Question No. 14 ################################################## #################################################### # # Show all patient's P_id, P_FirstName, P_LastName, and RBC # sorted ascending on P_FirstName and then descending on RBC # (hint: use pat_info, lab_info; expect 29 rows) # #################################################### ###### Question No. 15 ################################################## #################################################### # # Show how much is the avarage RBC in each city # (if the data for that city if available) # (hint: use pat_info, city_info, lab_info; expect 5 rows) # ####################################################