---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/select-limit-offset.md
cuppy_section: docs
cuppy_doc: KVM7-JP2N
cuppy_doc_uuid: 65ab0f36-1bd7-497c-8cce-848a99dff024
cuppy_permalink: https://cuppy.io/salesforce/d/KVM7-JP2N
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/select-limit-offset
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: 61eb94af6213805d20d510d7101a0d47571b28bc1a46d1e58f243b941d20700a
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/select-limit-offset.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

## `LIMIT`, `FETCH`, and `OFFSET` Clauses

The `LIMIT` clause specifies the maximum number of rows to return. `<count>` specifies the maximum number of rows to return. The `LIMIT` clause consists of two independent subclauses, `LIMIT { <count> | ALL }` and `OFFSET <start>`. `<start>` specifies the number of rows to skip before starting to return rows.

If you use `LIMIT`, use an `ORDER BY` that uniquely orders results. Without `ORDER BY`, you get a random subset of the query’s rows.

If the `<count>` expression evaluates to NULL, it’s treated as `LIMIT ALL`. If `<start>` evaluates to NULL, it’s treated the same as `OFFSET 0`.

An alternative to `LIMIT` and `OFFSET` is `FETCH` and `OFFSET`.

In this syntax, the `<start>` or `<count>` value is a literal constant, a parameter, or a variable name. The default `<count>` is 1. The `WITH TIES` option returns rows that tie for the last place in the result set.

For better pagination performance and consistency, use the Connect API `getSqlQueryRows` endpoint with `offset` and `rowLimit`. This approach reads row ranges from the result set without repeatedly querying your data set, reducing consumption costs. For more information, see [Query Best Practices](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/data-cloud-query-api-reference/c360a-api-queryservices-overview.html#best-practices).


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
