Examining nearby rows
The cats would like to see the average of the weight of them, the cat just after them and the cat just before them.
The first and last cats are content to have an average weight of consisting of 2 cats not 3.
Return: name, weight, average_weight
Order by: weight Show Table Schema
Correct output but can you use 'preceding'?
Rows allows us to examine the rows before and/or after the current row next question
select name, weight, avg(weight) over (order by weight ROWS between 1 preceding and 1 following) as average_weight from cats order by weight