Average Length of Stay per Diagnosis

Postgres Engine
Database Schema
Question (#66)
Calculate the average length of stay for each diagnosis for discharged cases (discharge_date IS NOT NULL). Round the result to 0 decimal places and sort by diagnosis alphabetically.
Expected Output
Query Editor
User Output Ready
Execute a query or press Ctrl+Enter to view results...
Databases & Questions
Hint
In PostgreSQL, subtracting one date from another gives a number of days.
Official Solutions
Select a solution...