Chapter 4 · Aggregations
72. Abnormal Result Rate by Lab Test
Medium20 XPHealthcare
The lab director wants to know the abnormality rate for each test. For each test_name, return the total number of results, the number of abnormal results, and the abnormal percentage (rounded to 1 decimal). Only include tests with at least 5 results. Sort by abnormal rate descending.
Tables
- PKidINT
- FKvisit_id→ visits.idINT
- test_nameTEXT
- result_valueTEXT
- unitTEXT
- reference_rangeTEXT
- is_abnormalINT
- tested_atTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.