---
title: "TRUNCATE"
url: "https://docs.yugabyte.com/stable/api/ycql/dml_truncate/"
---

# TRUNCATE

Use the TRUNCATE statement to remove all rows from a specified table.

## Synopsis

Use the `TRUNCATE` statement to remove all rows from a specified table.

## Syntax

### Diagram

TRUNCATETABLE[table\_name](/stable/api/ycql/grammar_diagrams#table-name)

### Grammar

```ebnf
truncate ::= TRUNCATE [ TABLE ] table_name;
```

Where

- `table_name` is an identifier (possibly qualified with a keyspace name).

## Semantics

- An error is raised if the specified `table_name` does not exist.

## Examples

### Truncate a table

```sql
ycqlsh:example> CREATE TABLE employees(department_id INT,
                                      employee_id INT,
                                      name TEXT,
                                      PRIMARY KEY(department_id, employee_id));
```

```sql
ycqlsh:example> INSERT INTO employees(department_id, employee_id, name) VALUES (1, 1, 'John');
```

```sql
ycqlsh:example> INSERT INTO employees(department_id, employee_id, name) VALUES (1, 2, 'Jane');
```

```sql
ycqlsh:example> INSERT INTO employees(department_id, employee_id, name) VALUES (2, 1, 'Joe');
```

```sql
ycqlsh:example> SELECT * FROM employees;
```

```output
 department_id | employee_id | name
---------------+-------------+------
             2 |           1 |  Joe
             1 |           1 | John
             1 |           2 | Jane
```

Remove all rows from the table.

```sql
ycqlsh:example> TRUNCATE employees;
```

```sql
ycqlsh:example> SELECT * FROM employees;
```

```output
 department_id | employee_id | name
---------------+-------------+------
```

## See also

- [CREATE TABLE](/stable/api/ycql/ddl_create_table "CREATE TABLE")
- [INSERT](/stable/api/ycql/dml_insert "INSERT")
- [SELECT](/stable/api/ycql/dml_select/ "SELECT")
- [UPDATE](/stable/api/ycql/dml_update/ "UPDATE")
- [DELETE](/stable/api/ycql/dml_delete/ "DELETE")
