Start here
How to Calculate the Average for Each Row in SQL
Learn how to get an average for each row in SQL, across columns in the same row or per group with AVG(), with NULL-safe examples and common mistakes.
Writing SQL
Row and column averages plus common functions and operators such as lag(), length() and !=.
Start here
Learn how to get an average for each row in SQL, across columns in the same row or per group with AVG(), with NULL-safe examples and common mistakes.
Learn how to use lag() in SQL to read a value from the previous row, with PARTITION BY and ORDER BY examples, default values and a running-average comparison.
Learn what != means in SQL: it checks that two values are not equal, like <>. See how NULL values behave with != and how to filter rows before averaging.
Learn what length() does in SQL, how MySQL, PostgreSQL and SQL Server count characters versus bytes, and how to average string lengths per group.
The function is AVG(). Learn how to use it to find each student's average marks with GROUP BY, handle NULL scores and round the result to one decimal place.
Related topics