Check out example codes for "mysql query with sql to get the next row". It will help you in understanding the concepts better.

Code Example 1

SELECT * FROM foo WHERE id = (SELECT MIN(id) FROM foo WHERE id > 4)

Learn ReactJs, React Native from akashmittal.com