From the course: Advanced SQL: Logical Query Processing, Part 1

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Paging result sets

Paging result sets - SQL Tutorial

From the course: Advanced SQL: Logical Query Processing, Part 1

Start my 1-month free trial

Paging result sets

- [Instructor] Paging, or pagination is the process of separating large row sets into smaller, disgestable chunks known as pages. Now, theoretically, this task is also the sole responsibility of the presentation tier and not that of the database. But as Albert Einstein once said, "In theory, theory and practice are the same. "In practice, they are not." Overloading the calling application or the middle tier with huge and potentially unused datasets may not always be the best course of action. So for paging purposes, I will take off my purist hat for a minute and consent that it does make sense to perform this task much closer to the data, and SQL is as close as it gets. Paging doesn't make sense without an order by, and in most databases, they are inseparable. SQL Server and Sybase support a proprietary non-ANSI compliant operator called Top, which is not strongly tied to an order by. So we can issue a query, such as…

Contents