SELECT id, file_name
FROM file
WHERE file_name > ${lastCursorFileName}
OR (file_name = ${lastCursorFileName} AND id > ${lastCursorId})
ORDER BY file_name ASC, id ASC
LIMIT 2
SELECT id, file_name
FROM file
WHERE file_name > 'A'
OR (file_name = 'A' AND id > 2)
ORDER BY file_name ASC, id ASC
LIMIT 2
출처 : https://namjug-kim.github.io/2019/02/15/mysql-paging-qeury.html