sql how to group by and then count average code example
Example 1: sql avg and group by
SELECT
AVG(depdelay),
origin
FROM flight_delays
WHERE distance > 2000
GROUP BY origin;
Example 2: sql avg group by
SELECT student_name, avg(notes) FROM student_notes GROUP BY student_name;