Database includes 4 tables, from these four table complete the following and submit the result sets along with the SQL scripts and Pivot table created.:
1. Select details of all patients aged less than 18 years on the visit date who were seen in more than one department in calendar year 2017. The result set should have ONLY one record for each patient and department combination.
Output fields: PATIENT_ID PATIENT_NAME BIRTH_DATE DEPARTMENT_NAME VISIT_COUNT
2. Select details of all patients with outstanding balance (CHARGES > INSURANCE_PAYMENT + PATIENT_PAYMENT) in each department, sorted DESCENDING by outstanding balance. Display Insurance as 'SELF-PAY' where INSURANCE_ID is blank.
Output fields: DEPT_NAME PATIENT_ID PATIENT_NAME INSURANCE_NAME OUTSTANDING_BALANCE
3. Select all transactions with visit dates in calendar year 2016 and 2017. Display Insurance as 'SELFPAY' where INSURANCE_ID is blank. Present the information in a pivot table organized by visit month and financial class. Display the total payment (Insurance Payment + Patient Payment) values in the pivot table.