0% found this document useful (0 votes)
47 views2 pages

Assignment 2

The assignment involves creating a healthcare database named HealthcareDB to apply SQL concepts in real-world scenarios. Students will design tables for patients, hospitals, admissions, and treatments, and perform various analytics queries to extract insights on demographics, hospital performance, treatment costs, and length of stay. Deliverables include SQL scripts for database creation, data insertion, and analytics queries, with evaluation based on design correctness and query efficiency.
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)
47 views2 pages

Assignment 2

The assignment involves creating a healthcare database named HealthcareDB to apply SQL concepts in real-world scenarios. Students will design tables for patients, hospitals, admissions, and treatments, and perform various analytics queries to extract insights on demographics, hospital performance, treatment costs, and length of stay. Deliverables include SQL scripts for database creation, data insertion, and analytics queries, with evaluation based on design correctness and query efficiency.
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/ 2

Assignment: Healthcare Analytics

Objective:

This assignment creates a healthcare database that allows you to apply SQL concepts to
real-world scenarios. By working with data on healthcare, students will practice extracting
actionable insights. Tasks will include analyzing demographics, hospital performance,
treatment costs, and length of stay, using advanced SQL functions like aggregation,
subqueries, and window functions.

Instructions:

● Create a database named HealthcareDB.


● Design and create the following tables with appropriate data types and constraints:

Patients:

● PatientID (Primary Key, INT)


● FullName (VARCHAR)
● Age (INT)
● Gender (VARCHAR)
● Address (VARCHAR)

Hospitals:

● HospitalID (Primary Key, INT)


● HospitalName (VARCHAR)
● Location (VARCHAR)
● Capacity (INT)

Admissions:

● AdmissionID (Primary Key, INT)


● PatientID (Foreign Key, INT)
● HospitalID (Foreign Key, INT)
● AdmissionDate (DATE)
● DischargeDate (DATE)
● ReasonForAdmission (VARCHAR)

Treatments:

● TreatmentID (Primary Key, INT)


● AdmissionID (Foreign Key, INT)
● ProcedureName (VARCHAR)
● Cost (DECIMAL)
● Outcome (VARCHAR)
Data Insertion:

● Use HealthcareDB Data.sql file to insert relevant data into the database.

Healthcare Analytics Queries:


● Patient Demographics: Retrieve the number of patients grouped by gender and
calculate the average age of patients.
● Hospital Utilization: Identify hospitals with the highest number of admissions.
● Treatment Costs: Calculate the total cost of treatments provided at each hospital.
● Length of Stay Analysis: Extract the average length of stay for patients grouped by
hospital.

Advanced Filtering:

● List all patients who stayed longer than 7 days in any hospital.
● Identify treatments that have been performed more than 5 times across all hospitals.

Combining Data:

● Combine admission and treatment data to display complete patient histories.


● Combine lists of patients admitted for different reasons (e.g., surgery and therapy).

Subqueries and Views:

● Use a subquery to find the hospital with the highest average treatment cost.
● Create a view named HospitalPerformance to display the total number of admissions,
average length of stay, and total revenue generated for each hospital.

Window Functions:

● Use the RANK function to rank hospitals based on their total revenue.
● Use DENSE_RANK to rank treatments based on their frequency.

Deliverables:

● Submit the SQL scripts for creating the database, tables, and inserting data.

Evaluation Criteria:

● Correctness and efficiency of database design and queries.


● Relevance and accuracy of the analytics queries.
● Proper use of constraints, joins, and window functions.

You might also like