Complete the code to select the correct pagination method for simple page numbers.
SELECT * FROM items ORDER BY id LIMIT 10 OFFSET [1];
Offset pagination uses the page number multiplied by page size to skip records.
Complete the code to fetch the next page using cursor pagination.
SELECT * FROM items WHERE id > [1] ORDER BY id LIMIT 10;
Cursor pagination uses the last seen item's id as the cursor to fetch the next set.
Fix the error in the pagination query to avoid skipping or duplicating items.
SELECT * FROM items WHERE id >= [1] ORDER BY id LIMIT 10;
Using 'id >= last_seen_id' causes duplication; it should be 'id > last_seen_id' to avoid repeats.
Fill both blanks to implement offset pagination with page size and offset calculation.
SELECT * FROM items ORDER BY created_at DESC LIMIT [1] OFFSET [2];
Limit is the page size, offset is page_number multiplied by page_size for offset pagination.
Fill all three blanks to implement cursor pagination with sorting and cursor parameter.
SELECT * FROM items WHERE [1] > [2] ORDER BY [3] ASC LIMIT 20;
Cursor pagination uses a timestamp or unique field (created_at) to fetch items after the cursor timestamp, ordered by the same field.