# FOUND\_ROWS

Returns the number of rows when using commands that return a resultset, such as `SELECT`, `DESC`, and `SHOW`.

## Syntax

```sql
FOUND_ROWS()
```

## Arguments

* None

## Return Type

int

## Examples

```sql
SHOW TABLES;

```

```output

+--------------+
| Tables_in_db |
+--------------+
| testdata     |
+--------------+
```

```sql
SELECT FOUND_ROWS();

```

```output

+--------------+
| FOUND_ROWS() |
+--------------+
|            1 |
+--------------+
```

```sql
SELECT ID FROM neighborhoods LIMIT 2;

```

```output

+------+
| id   |
+------+
|    1 |
|    3 |
+------+
```

```sql
SELECT FOUND_ROWS();

```

```output

+--------------+
| FOUND_ROWS() |
+--------------+
|            2 |
+--------------+
```

```sql
SELECT * FROM testdata;

```

```output

+----------+
| Results  |
+----------+
|        1 |
|        2 |
|        3 |
|        4 |
|        5 |
+----------+ 
```

```sql
SELECT FOUND_ROWS;

```

```output

+--------------+
| FOUND_ROWS() |
+--------------+
|            5 |
+--------------+
```

```sql
DESC testdata;

```

```output

+-------+---------+------+------+---------+-----------+
| Field  | Type       | Null | Key  | Default | Extra |
+-------+-------------+------+------+---------+-------+
| id     | int(10)    | NO   |      | NULL    |       |
+--------+------------+------+------+---------+-------+
| name   | varchar(64)| NO   |      | NULL    |       |
+--------+------------+------+------+---------+-------+        
| amount | int(10)    | NO   |      | NULL    |       |
+-------+---------+------+------+---------+-----------+
```

```sql
SELECT FOUND_ROWS;

```

```output

+--------------+
| FOUND_ROWS() |
+--------------+
|            1 |
+--------------+
```

> **📝 Note**: Please note, there can be an incorrect result given when running a query using `LIMIT` with an offset. See the following example:

```sql
CREATE TABLE t1(a BIGINT PRIMARY KEY AUTO_INCREMENT, b INT);

INSERT random integers into t1 so total row count is greater than LIMIT argument.

SELECT COUNT(*) FROM t1 GROUP BY a ORDER BY a LIMIT 5,10;
+----------+
| COUNT(*) |
+----------+
|        1 |
|        1 |
|        1 |
|        1 |
|        1 |
|        1 |
|        1 |
|        1 |
|        1 |
|        1 |
+----------+
10 rows in set (0.03 sec)
 
SELECT FOUND_ROWS(); -- the result should be 10
+--------------+
| FOUND_ROWS() |
+--------------+
|           15 |
+--------------+
1 row in set (0.00 sec)
```

***

Modified at: April 4, 2023

Source: [/db/v9.1/reference/sql-reference/information-functions/found-rows/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/information-functions/found-rows/)

(An index of the documentation is available at /llms.txt)
