LIMIT OFFSET in SQL
Level 376 keystrokes
OFFSET skips a specified number of rows before returning results.
SQL code
-- Return the id, name and price of products1SELECT2 id,3 name,4 price5FROM6 products-- Sort from the most expensive to the cheapest7ORDER BY8 price DESC-- OFFSET 20 skips the first 20 rows, then LIMIT 10 returns up to 10 rows-- This is page 3 with 10 items per page (rows 21-30); here only 3 rows remain9LIMIT10 10 OFFSET 20;Output
+----+---------+-------+ | id | name | price | +----+---------+-------+ | 21 | Laptop | 899.0 | | 22 | Tablet | 599.0 | | 23 | Monitor | 399.0 | +----+---------+-------+ 3 rows in set
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this SQL code and how often they appear.
,× 2;× 1