SQL Project Series #7 Hospital Management Analysis ๐Ÿฅ Learn howโ€ฆ

๐Ÿš€ SQL Project Series #7 Hospital Management Analysis ๐Ÿฅ Learn how hospitals use SQL to analyze patient data, optimize operations, improve resource utilization, and generate healthcare insights. ๐ŸŽฏ Business Objectives โœ… Analyze patient admissions โœ… Monitor doctor performance โœ… Track appointment trends โœ… Measure bed occupancy โœ… Analyze treatment costs โœ… Identify readmitted patients โœ… Calculate average length of stay โœ… Improve hospital efficiency ๐Ÿ“‚ Step 1: Create Database CREATE DATABASE hospital_db; USE hospital_db; ๐Ÿ“‚ Step 2: Create Patients Table CREATE TABLE patients ( patient_id INT PRIMARY KEY, patient_name VARCHAR(100), gender VARCHAR(10), age INT, city VARCHAR(50), registration_date DATE ); ๐Ÿ“‚ Step 3: Create Doctors Table CREATE TABLE doctors ( doctor_id INT PRIMARY KEY, doctor_name VARCHAR(100), specialization VARCHAR(100), department VARCHAR(100) ); ๐Ÿ“‚ Step 4: Create Appointments Table CREATE TABLE appointments ( appointment_id INT PRIMARY KEY, patient_id INT, doctor_id INT, appointment_date DATE, status VARCHAR(20), consultation_fee DECIMAL(10,2), FOREIGN KEY (patient_id) REFERENCES patients(patient_id), FOREIGN KEY (doctor_id) REFERENCES doctors(doctor_id) ); ๐Ÿ“‚ Step 5: Create Admissions Table CREATE TABLE admissions ( admission_id INT PRIMARY KEY, patient_id INT, admission_date DATE, discharge_date DATE, diagnosis VARCHAR(100), treatment_cost DECIMAL(12,2), FOREIGN KEY (patient_id) REFERENCES patients(patient_id) ); ๐Ÿ“‚ Step 6: Insert Sample Patients INSERT INTO patients VALUES (1,'Rahul Sharma','Male',34,'Mumbai','2024-01-05'), (2,'Priya Verma','Female',29,'Delhi','2024-01-10'), (3,'Amit Patel','Male',42,'Pune','2024-02-15'), (4,'Sneha Joshi','Female',37,'Bangalore','2024-03-01'), (5,'Rohan Gupta','Male',51,'Hyderabad','2024-03-20'); ๐Ÿ“‚ Step 7: Insert Sample Doctors INSERT INTO doctors VALUES (101,'Dr. Mehta','Cardiology','Heart Care'), (102,'Dr. Singh','Orthopedics','Bone Care'), (103,'Dr. Rao','Neurology','Neuro Care'), (104,'Dr. Shah','General Medicine','General'); ๐Ÿ“‚ Step 8: Insert Sample Appointments INSERT INTO appointments VALUES (1001,1,101,'2025-01-05','Completed',800), (1002,2,104,'2025-01-06','Completed',500), (1003,3,102,'2025-01-08','Cancelled',700), (1004,4,103,'2025-01-09','Completed',1000), (1005,5,101,'2025-01-12','Completed',800); ๐Ÿ“‚ Step 9: Insert Sample Admissions INSERT INTO admissions VALUES (201,1,'2025-01-05','2025-01-10','Heart Surgery',250000), (202,2,'2025-01-08','2025-01-11','Fever',12000), (203,3,'2025-01-15','2025-01-22','Fracture',85000), (204,5,'2025-01-18','2025-01-21','Cardiac Checkup',45000); ๐Ÿง  SQL Concepts You'll Practice โœ” DDL & DML โœ” Joins โœ” Aggregate Functions โœ” GROUP BY โœ” HAVING โœ” CASE WHEN โœ” CTEs โœ” Window Functions โœ” Date Functions โœ” Ranking Functions ๐Ÿ“Š Business KPIs You Can Build ๐Ÿ“ˆ Total Patients ๐Ÿ“ˆ Total Admissions ๐Ÿ“ˆ Total Appointments ๐Ÿ“ˆ Appointment Completion Rate ๐Ÿ“ˆ Appointment Cancellation Rate ๐Ÿ“ˆ Doctor-wise Patient Count ๐Ÿ“ˆ Department-wise Revenue ๐Ÿ“ˆ Average Consultation Fee ๐Ÿ“ˆ Average Treatment Cost ๐Ÿ“ˆ Average Length of Stay ๐Ÿ“ˆ Daily Patient Admissions ๐Ÿ“ˆ Monthly Admission Trend ๐Ÿ“ˆ Readmission Rate ๐Ÿ“ˆ Bed Occupancy Rate ๐Ÿ“ˆ Top Doctors by Patient Volume ๐Ÿ“ˆ Revenue by Department ๐Ÿ“ˆ Revenue by Doctor ๐Ÿ“ˆ Most Common Diagnosis ๐Ÿ“ˆ Patient Distribution by City ๐Ÿ“ˆ Average Patient Age ๐ŸŽฏ This project reflects the type of SQL analysis performed by Healthcare Analysts, Hospital Operations teams, Business Intelligence Analysts, and Data Analysts working in hospitals and health-tech companies. ๐Ÿ’ก Double Tap โค๏ธ For More

โค7
October 19, 2026 1.3K