Comments - Window Frames

1 year, 5 months ago stardust young

The current row and the following row:

SELECT name, test, score, SUM(score) OVER (ORDER BY score ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS total_score FROM student_test ORDER BY score; +---------+--------+-------+-------------+

nametestscoretotal_score

+---------+--------+-------+-------------+

EsbenTuning3174
EsbenSQL43130
KaolinSQL56172
ChunTuning73204
ChunSQL75235
TatianaSQL87250
KaolinTuning88175

+---------+--------+-------+-------------+

`The current row and the following row:` the descrption may be wrong. or chang the sql 'ORDER BY score ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING' to `ORDER BY score ROWS BETWEEN 0 PRECEDING AND 1 FOLLOWING`

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.