2020-07-14 21:02:41 +00:00
|
|
|
---
|
2022-04-09 13:29:05 +00:00
|
|
|
sidebar_position: 43
|
|
|
|
sidebar_label: CONSTRAINT
|
2020-07-14 21:02:41 +00:00
|
|
|
---
|
|
|
|
|
2022-06-02 10:55:18 +00:00
|
|
|
# Manipulating Constraints
|
2020-07-14 21:02:41 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2022-04-09 13:29:05 +00:00
|
|
|
:::warning
|
|
|
|
Constraint check **will not be executed** on existing data if it was added.
|
|
|
|
:::
|
2020-07-14 21:02:41 +00:00
|
|
|
|
|
|
|
All changes on replicated tables are broadcasted to ZooKeeper and will be applied on other replicas as well.
|