The SQL AVG function is used to calculate the average value of a numeric column in a table.
SQL Avg Syntax
SQL
x
1
SELECT AVG(column_name)
2
FROM table_name
SQL Avg Example
SQL Avg Number of Prescribed Medications Example
This query calculates the average number of medications prescibed to patients, based on the Prescriptions table.
SQL
1
1
SELECT AVG(prescription_id) AS avg_prescriptions
2
FROM Prescriptions;

SQL Avg Visual Diagram
