ClickHouse/docs/en/sql-reference/statements/truncate.md

15 lines
615 B
Markdown
Raw Normal View History

2020-07-11 11:05:49 +00:00
---
toc_priority: 52
2020-07-23 13:04:13 +00:00
toc_title: TRUNCATE
2020-07-11 11:05:49 +00:00
---
# TRUNCATE Statement {#truncate-statement}
``` sql
TRUNCATE TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster]
```
Removes all data from a table. When the clause `IF EXISTS` is omitted, the query returns an error if the table does not exist.
The `TRUNCATE` query is not supported for [View](../../engines/table-engines/special/view.md), [File](../../engines/table-engines/special/file.md), [URL](../../engines/table-engines/special/url.md), [Buffer](../../engines/table-engines/special/buffer.md) and [Null](../../engines/table-engines/special/null.md) table engines.