sql group by avg code example Example: sql avg and group by SELECT AVG(depdelay), origin FROM flight_delays WHERE distance > 2000 GROUP BY origin;