Files
supabase/apps/reference/_supabase_js/generated/range.mdx
2022-08-18 15:54:30 +08:00

96 lines
1.9 KiB
Plaintext

---
id: range
title: 'range()'
slug: /range
custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml
---
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
Limits the result to rows within the specified range, inclusive.
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.range(0, 3)
```
## Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
from
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>number</code>
</span>
</h4>
<div class="method-list-item-description">
The starting index from which to limit the result, inclusive.
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
to
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>number</code>
</span>
</h4>
<div class="method-list-item-description">
The last index to which to limit the result, inclusive.
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
foreignTable
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>object</code>
</span>
</h4>
<div class="method-list-item-description">
The foreign table to use (for foreign columns).
</div>
</li>
</ul>
## Examples
### With `select()`
```js
const { data, error } = await supabase
.from('cities')
.select('name, country_id')
.range(0, 3)
```