0
0
PostgreSQLquery~10 mins

LIMIT and OFFSET pagination in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select the first 5 rows from the table.

PostgreSQL
SELECT * FROM employees [1] 5;
Drag options to blanks, or click blank then click option'
AOFFSET
BWHERE
CORDER BY
DLIMIT
Attempts:
3 left
💡 Hint
Common Mistakes
Using OFFSET instead of LIMIT to restrict rows.
Using WHERE clause incorrectly to limit rows.
2fill in blank
medium

Complete the code to skip the first 10 rows and return the next 5 rows.

PostgreSQL
SELECT * FROM employees [1] 10 [2] 5;
Drag options to blanks, or click blank then click option'
ALIMIT
BOFFSET
CWHERE
DORDER BY
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping LIMIT and OFFSET order.
Using WHERE instead of OFFSET to skip rows.
3fill in blank
hard

Fix the error in the query to paginate results correctly.

PostgreSQL
SELECT * FROM employees LIMIT [1] OFFSET 10;
Drag options to blanks, or click blank then click option'
AOFFSET
B5
C10
DWHERE
Attempts:
3 left
💡 Hint
Common Mistakes
Putting OFFSET number immediately after LIMIT without OFFSET keyword.
Using WHERE instead of OFFSET.
4fill in blank
hard

Fill both blanks to select 7 rows after skipping 20 rows.

PostgreSQL
SELECT * FROM employees [1] 7 [2] 20;
Drag options to blanks, or click blank then click option'
ALIMIT
BWHERE
COFFSET
DORDER BY
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHERE instead of OFFSET to skip rows.
Swapping LIMIT and OFFSET order.
5fill in blank
hard

Fill all three blanks to select 10 rows after skipping 30 rows, ordered by employee_id.

PostgreSQL
SELECT * FROM employees [1] employee_id [2] 10 [3] 30;
Drag options to blanks, or click blank then click option'
AORDER BY
BLIMIT
COFFSET
DWHERE
Attempts:
3 left
💡 Hint
Common Mistakes
Placing LIMIT before ORDER BY.
Using WHERE instead of OFFSET.
Swapping LIMIT and OFFSET order.