Complete the code to select the first 5 rows from the table.
SELECT * FROM employees [1] 5;
The LIMIT clause restricts the number of rows returned by the query. Here, it returns the first 5 rows.
Complete the code to skip the first 10 rows and return the next 5 rows.
SELECT * FROM employees [1] 10 [2] 5;
The OFFSET clause skips the first 10 rows, and LIMIT returns the next 5 rows.
Fix the error in the query to paginate results correctly.
SELECT * FROM employees LIMIT [1] OFFSET 10;
The LIMIT clause must be followed by the number of rows to return. The OFFSET clause should come after LIMIT with its own number.
Fill both blanks to select 7 rows after skipping 20 rows.
SELECT * FROM employees [1] 7 [2] 20;
LIMIT sets how many rows to return, and OFFSET sets how many rows to skip before starting to return rows.
Fill all three blanks to select 10 rows after skipping 30 rows, ordered by employee_id.
SELECT * FROM employees [1] employee_id [2] 10 [3] 30;
ORDER BY sorts the rows by employee_id. LIMIT restricts to 10 rows, and OFFSET skips the first 30 rows.