SQLSQL
#7

Implement API Pagination with LIMIT and OFFSET in SQL

Easy
Interview Question #7

Given an `articles` table, write a SQL query to retrieve page 3 of articles, where each page contains 10 articles. Sort articles by `published_at` descending.

Input Table: articles
25 rows preview
article_idtitlepublished_at
1Data Trends 20262026-03-30
2SQL Guide2026-03-29
3Article 32026-03-28
4Article 42026-03-27
5Article 52026-03-26
6Article 62026-03-25
7Article 72026-03-24
8Article 82026-03-23
9Article 92026-03-22
10Article 102026-03-21
11Article 112026-03-20
12Article 122026-03-19
13Article 132026-03-18
14Article 142026-03-17
15Article 152026-03-16
16Article 162026-03-15
17Article 172026-03-14
18Article 182026-03-13
19Article 192026-03-12
20Article 202026-03-11
21Article 212026-03-10
22Article 222026-03-09
23Article 232026-03-08
24Article 242026-03-07
25Article 252026-03-06
Expected Output Structure1 rows
article_idtitlepublished_at
21Article 212026-03-10
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us