SQL functions like COUNT()
, SUM()
, AVG()
, MIN()
, and MAX()
allow you to summarize and calculate data directly in your queries.
Example:
SELECT COUNT(*) AS PatientCount
FROM Prescriptions
WHERE Medication = 'Warfarin';
This counts patients on warfarin.
💡 Future clinical idea: Use AVG()
to calculate the average length of stay for patients on a specific antibiotic regimen to track stewardship outcomes.