Questions: SQL: Sorting, Limiting, and Pagination

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A developer runs: SELECT department FROM employees ORDER BY salary DESC LIMIT 5. The column 'salary' is not in the SELECT list. What happens?

AThe query fails because you can only ORDER BY columns that appear in SELECT
BThe query succeeds and returns the 5 departments of the highest-paid employees
CThe query returns 5 rows but salary values are substituted with NULL
DThe query runs but ignores the ORDER BY clause since salary is not selected
Question 2 Multiple Choice

A web app shows products 10 per page. Page 1 uses OFFSET 0, page 2 uses OFFSET 10, and so on. What is the fundamental performance problem with this approach at page 500?

AOFFSET 4990 is a syntax error in SQL
BThe database reads and discards 4990 rows internally before returning 10, making deep pages progressively slower
CLIMIT 10 with a large OFFSET returns duplicate rows across pages
DORDER BY becomes unreliable when combined with large OFFSET values
Question 3 True / False

ORDER BY is applied after WHERE filtering, meaning rows are sorted from the already-filtered result set.

TTrue
FFalse
Question 4 True / False

Using LIMIT without ORDER BY guarantees you receive the same set of rows each time you run the query.

TTrue
FFalse
Question 5 Short Answer

Why does OFFSET-based pagination become progressively slower on large datasets, and what does this imply about how it should be used?

Think about your answer, then reveal below.