Check out example codes for "get row number in mysql 5.5". It will help you in understanding the concepts better.

Code Example 1

set @row_number := 0;

SELECT 
    @row_number:=CASE
        WHEN @customer_no = customerNumber 
			THEN @row_number + 1
        ELSE 1
    END AS num,
    @customer_no:=customerNumber customerNumber,
    paymentDate,
    amount
FROM
    payments
ORDER BY customerNumber;

Learn ReactJs, React Native from akashmittal.com