---
schema_version: "1"
id: f2633de77ad2252895fd0f59df747ee0749ca862cdcb79559b4cd7f147dea428
title: LIMIT 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-limit.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-limit.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: edd48637dacebc14ccde3234c7a7c67593ab0d7c12b210a5fb942cf441e1b81a
products:
  - SQL for Analytics Developer Guide
  - analytics
---

# LIMIT Clause

The `LIMIT` clause specifies the maximum number of rows to return. If no `LIMIT` clause is specified, then SQL returns all rows.

`LIMIT` follows the syntax `LIMIT {count}`.

**important:** When working with two or more columns, make sure to use `LIMIT` with an `ORDER BY` clause, so that your results are returned in a specified order. Otherwise, results return in an order you may not want. ORDER BY is optional for working with a single column.

Here’s an example.

```nolang
SELECT City
FROM "Superstore"
ORDER BY City
LIMIT 5;
```

This query returns the cities in the first three rows of the dataset.

| City     |
| -------- |
| Aberdeen |
| Abilene  |
| Akron    |
| Akron    |
| Akron    |
