Complete the code to add a keyset pagination parameter to the API endpoint.
GET /items?[1]=100
Keyset pagination uses a cursor like last_id to fetch the next set of results efficiently.
Complete the SQL WHERE clause to implement keyset pagination using the last seen ID.
SELECT * FROM items WHERE id [1] ? ORDER BY id ASC LIMIT 10
To get the next page, select rows with IDs greater than the last seen ID.
Fix the error in the API query parameter for keyset pagination.
GET /items?[1]=abc123The keyset pagination cursor should be named last_id to indicate the last item fetched.
Fill both blanks to complete the SQL query for keyset pagination with a timestamp cursor.
SELECT * FROM events WHERE event_time [1] ? ORDER BY event_time [2] LIMIT 20
To get newer events, select where event_time is greater than the cursor and order ascending.
Fill all three blanks to complete the Python function that builds a keyset pagination query.
def get_items_query(last_id): query = "SELECT * FROM items WHERE id [1] [2] ORDER BY id [3] LIMIT 10" return query
The query uses '>' to get items after last_id, uses a placeholder '?' for parameter, and orders ascending.