range()

Limit the query result by from and to inclusively.

1const { data, error } = await supabase
2  .from('countries')
3  .select('name')
4  .range(0, 1)

Parameters#

  • fromrequired
    number

    The starting index from which to limit the result

  • torequired
    number

    The last index to which to limit the result

  • optionsrequired
    object

    Named parameters

      Properties
    • foreignTableoptional
      string

      Set this to limit rows of foreign tables instead of the current table

Examples#

With select()#

1create table
2  countries (id int8 primary key, name text);
3
4insert into
5  countries (id, name)
6values
7  (1, 'Afghanistan'),
8  (2, 'Albania'),
9  (3, 'Algeria');