---
title: LIMIT clause
description: Use the LIMIT clause to limit the number of results returned by a query.
url: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/sql/limit/
estimated_tokens: 536
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/sql/limit/
date: '2025-04-03T12:43:17-06:00'
lastmod: '2025-04-03T12:43:17-06:00'
---

The `LIMIT` clause limits the number of rows returned by a query to a specified non-negative integer.

* [Syntax](#syntax)
* [Examples](#examples)

## Syntax

```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT <N>
```

## Examples

### Limit results to a maximum of five rows

```
SELECT
  "water_level","location", "time"
FROM
  "h2o_feet"
LIMIT
  5
```

[](#view-example-results)

View example results

The query returns a maximum of 5 results.

|  location   |          time          |water\_level|
|-------------|------------------------|------------|
|coyote\_creek|2019-08-28T00:00:00.000Z|   4.206    |
|coyote\_creek|2019-08-28T00:06:00.000Z|   4.052    |
|coyote\_creek|2019-08-28T00:12:00.000Z|   3.901    |
|coyote\_creek|2019-08-28T00:18:00.000Z|   3.773    |
|coyote\_creek|2019-08-28T00:24:00.000Z|   3.632    |

### Sort and limit results

Use the `ORDER BY` and `LIMIT` clauses to first sort results by specified columns,
then limit the sorted results by a specified number.

```
SELECT
  "water_level", "location", "time"
FROM
  "h2o_feet"
ORDER BY
  "water_level" DESC
LIMIT
  3
```

[](#view-example-results)

View example results

The query returns the highest 3 `water_level` readings in the `h2o_feet` measurement.

|  location   |          time          |water\_level|
|-------------|------------------------|------------|
|coyote\_creek|2019-08-27T13:42:00.000Z|  \-0.561   |
|coyote\_creek|2019-08-29T15:24:00.000Z|  \-0.571   |
|coyote\_creek|2019-08-28T14:24:00.000Z|  \-0.587   |
| location | time | water_level |
| --- | --- | --- |
| location | time | water_level |
| coyote_creek | 2019-08-28T00:00:00.000Z | 4.206 |
| coyote_creek | 2019-08-28T00:06:00.000Z | 4.052 |
| coyote_creek | 2019-08-28T00:12:00.000Z | 3.901 |
| coyote_creek | 2019-08-28T00:18:00.000Z | 3.773 |
| coyote_creek | 2019-08-28T00:24:00.000Z | 3.632 |

| location | time | water_level |
| --- | --- | --- |
| location | time | water_level |
| coyote_creek | 2019-08-27T13:42:00.000Z | -0.561 |
| coyote_creek | 2019-08-29T15:24:00.000Z | -0.571 |
| coyote_creek | 2019-08-28T14:24:00.000Z | -0.587 |
