row_number function in mysql code example
Example 1: mysql row_number() example
SET @row_number = 0;
SELECT
(@row_number:=@row_number + 1) AS num,
firstName,
lastName
FROM
employees
ORDER BY firstName, lastName
LIMIT 5;
Example 2: row number mysql
SELECT row_number() over ( order by firstName) RowNumberSqeuence,FirstName from rowNumberDemo
order by FirstName;