top of page
MySQL:
ROW_NUMBER
ROW_NUMBER() over_clause
Returns the number of the current row within its partition. Rows
numbers range from 1 to the number of partition rows.
ORDER BY affects the order in which rows are numbered. Without ORDER
BY, row numbering is nondeterministic.
ROW_NUMBER() assigns peers different row numbers. To assign peers the
same value, use RANK() or DENSE_RANK(). For an example, see the RANK()
function description.
over_clause is as described in
https://dev.mysql.com/doc/refman/8.0/en/window-functions-usage.html.
URL: https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html
Example
bottom of page