# TRUNCATE TABLE keyword

> **For AI agents:** the complete documentation index is at [llms.txt](https://questdb.com/docs/llms.txt). Every page is available as markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` request header.

TRUNCATE SQL keyword reference documentation.

`TRUNCATE TABLE` permanently deletes the contents of a table without deleting
the table itself.

## Syntax

```questdb-sql
TRUNCATE TABLE [IF EXISTS] tableName;
```

### IF EXISTS

An optional `IF EXISTS` clause may be added directly after the `TRUNCATE TABLE`
keywords to indicate that the selected table should be truncated only if it exists.
Without `IF EXISTS`, QuestDB will throw an error if the table does not exist.

## Notes

This command irremediably deletes the data in the target table. In doubt, make
sure you have created [backups](/docs/operations/backup/) of your data.

## Examples

```questdb-sql
TRUNCATE TABLE trades;
```

This example will not throw an error, even if the table does not exist:

```questdb-sql
TRUNCATE TABLE IF EXISTS trades_non_existent;
```
## See also

To delete both the data and the table structure, use
[DROP](/docs/query/sql/drop/).
