ClickHouse/docs/en/sql-reference/statements/alter/constraint.md
2022-06-02 04:55:18 -06:00

24 lines
679 B
Markdown

---
sidebar_position: 43
sidebar_label: CONSTRAINT
---
# Manipulating Constraints
Constraints could be added or deleted using following syntax:
``` sql
ALTER TABLE [db].name ADD CONSTRAINT constraint_name CHECK expression;
ALTER TABLE [db].name DROP CONSTRAINT constraint_name;
```
See more on [constraints](../../../sql-reference/statements/create/table.md#constraints).
Queries will add or remove metadata about constraints from table so they are processed immediately.
:::warning
Constraint check **will not be executed** on existing data if it was added.
:::
All changes on replicated tables are broadcasted to ZooKeeper and will be applied on other replicas as well.