How do you paginate results in SQL?
Model answer
LIMIT 20 OFFSET 40 for page three with 20 per page. OFFSET gets slower on deep pages because rows are still scanned. Keyset pagination (WHERE id > last_id ORDER BY id LIMIT 20) is faster and more stable for large tables.
Learn this topic
SELECT, FROM and WHERE: Your First Queries in the course SQL for Beginners: Learn Databases Step by Step.
Sign in to add your own answer.