Writing SQL

Averages and SQL Functions

Row and column averages plus common functions and operators such as lag(), length() and !=.

How to use lag() in SQL?

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.

2 min read

What does != mean in SQL?

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.

1 min read

What is length() in SQL?

Learn what length() does in SQL, how MySQL, PostgreSQL and SQL Server count characters versus bytes, and how to average string lengths per group.

2 min read

Related topics

More in writing sql