Average Hospital Stay by Department
Medium
Healthcare Queries
Length of stay is discharge_date minus admit_date in days. Return each department and its average stay rounded to 2 decimals, ordered by department.
Table schema
Admissions(id INT PRIMARY KEY, dept VARCHAR(20), admit_date DATE, discharge_date DATE)Sample data
id | dept | admit_date | discharge_date
1 | Cardiology | 2026-01-01 | 2026-01-05
2 | Cardiology | 2026-01-10 | 2026-01-13
3 | Ortho | 2026-02-01 | 2026-02-08
4 | Ortho | 2026-02-10 | 2026-02-12
5 | Ortho | 2026-03-01 | 2026-03-02
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.