Appearance
OFFSET Clause
Use the OFFSET clause to define a starting point for the set of rows that a query returns. (You must use OFFSET in combination with ORDER BY to guarantee where the offset falls with respect to an ordered set of rows.)
[ OFFSET start [ ROW | ROWS ] ]
The start
argument defines the starting number for the rows that are returned (row 10 or row 10000, for example). You cannot use a negative number. ROW
and ROWS
are optional keywords that have no effect.
For example:
premdb=# select * from match
order by matchday
limit 10
offset 5000;
seasonid | matchday | htid | atid | ftscore | htscore
----------+---------------------+------+------+---------+---------
13 | 2004-12-28 00:00:00 | 42 | 65 | 1-1 | 0-0
13 | 2004-12-28 00:00:00 | 27 | 78 | 2-0 | 0-0
13 | 2004-12-28 00:00:00 | 8 | 55 | 0-1 | 0-1
13 | 2004-12-28 00:00:00 | 3 | 75 | 0-1 | 0-1
13 | 2004-12-28 00:00:00 | 13 | 67 | 2-0 | 0-0
13 | 2004-12-29 00:00:00 | 28 | 51 | 0-1 | 0-1
13 | 2005-01-01 00:00:00 | 13 | 51 | 1-3 | 1-1
13 | 2005-01-01 00:00:00 | 24 | 63 | 0-1 | 0-0
13 | 2005-01-01 00:00:00 | 8 | 93 | 1-1 | 0-1
13 | 2005-01-01 00:00:00 | 27 | 75 | 0-2 | 0-1
(10 rows)
Parent topic:SELECT