Limit the query to a range
Limit the query result by starting at an offset (from
) and ending at the offset (from + to
).
Only records within this range are returned.
This respects the query order and if there is no order clause the range could behave unexpectedly.
The from
and to
values are 0-based and inclusive: range(1, 3)
will include the second, third
and fourth rows of the query.
Parameters
from
REQUIRED
numberThe starting index from which to limit the result
to
REQUIRED
numberThe last index to which to limit the result
options
Optional
objectNamed parameters
foreignTable
Optional
stringDeprecated, use `options.referencedTable` instead
referencedTable
Optional
stringSet this to limit rows of referenced tables instead of the parent table
const { data, error } = await supabase
.from('countries')
.select('name')
.range(0, 1)