In clinical work, I often need to know “the first” or “the highest.” SQL’s MIN and MAX functions handle that without sifting through endless rows.
Example: Find the highest potassium level recorded for a patient:
SELECT MAX(LabValue) AS HighestK
FROM LabResults
WHERE TestName = 'Potassium'
AND PatientID = 1234;
Practical idea:
- Use
MINto find a patient’s earliest admission date. - Use
MAXto identify the most recent therapeutic drug level result.
These functions turn large datasets into quick, targeted insights.