---
schema_version: "1"
id: fbd6d94d5415983883031661878ff332e5d773650406428666f26ad59999df3e
title: FETCH Clause
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_sql/guides/bi-sql-fetch.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-fetch.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 01b15b931328838e0bb7ff52d74032ec3730f19a1ffcd365f458c5336b64ac84
products:
  - SQL for Analytics Developer Guide
  - analytics
---

# FETCH Clause

The `FETCH` clause specifies the number of rows to return. If no `FETCH` clause is specified, then SQL returns all rows.

`FETCH` follows this syntax. `FETCH {FIRST||NEXT} {count} {ROW|ROWS} ONLY`

- FIRST

  - : Returns the count of rows beginning from the first row in the dataset.

- NEXT

  - : Returns the count of rows that immediately follow the current row.

- count

  - : Optional. The number of rows to return. If you don't specify a count, `FETCH` returns one row by default.

**note:** `FETCH FIRST ROW ONLY` is the same as `FETCH FIRST 1 ROW ONLY`.

In this example, because there’s an offset of one row, `FETCH` starts from the second value of the `City` column, ordered ascending. The query returns the next three rows, which are the second, third, and fourth rows.

```nolang
SELECT City
FROM "Superstore"
OFFSET 1
ORDER BY City
FETCH NEXT 3 ROWS ONLY;
```

| City    |
| ------- |
| Abilene |
| Abilene |
| Akron   |

Here, the query returns the first row.

```nolang
SELECT City
FROM "Superstore"
ORDER BY City
FETCH FIRST ROW ONLY;
```

| City     |
| -------- |
| Aberdeen |
