Start here. This is the direct spoken answer to practice first.
Why this question matters
Pagination looks like an API detail, but the database shape decides whether a list stays fast and stable. This is a practical bridge between SQL and backend design.
Offset pagination is simple: skip N rows and take the next page. It works well for small lists and admin screens where jumping to a page number matters. Keyset pagination uses the last seen sort key as a cursor, such as created_at and id, then asks for rows after that cursor. It is often better for large, scrolling lists because the database can continue from an indexed position instead of counting past many rows.