> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-55d9d317.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for Manipulating Constraints

# Manipulating Constraints

Constraints could be added, modified or deleted using following syntax:

```sql theme={null}
ALTER TABLE [db].name [ON CLUSTER cluster] ADD CONSTRAINT [IF NOT EXISTS] constraint_name {CHECK|ASSUME} expression;
ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY CONSTRAINT [IF EXISTS] constraint_name {CHECK|ASSUME} expression;
ALTER TABLE [db].name [ON CLUSTER cluster] DROP CONSTRAINT [IF EXISTS] constraint_name;
```

As with table creation, a constraint can be declared either as `CHECK` (enforced on `INSERT`) or as `ASSUME` (trusted by the optimizer without being checked). See [constraints](/reference/statements/create/table#constraints) for the difference between the two.

`MODIFY CONSTRAINT` replaces the declaration of an existing constraint, keeping its position in the table definition. It can also change the constraint kind (for example, from `CHECK` to `ASSUME`). It is equivalent to dropping the constraint and adding it again with the new declaration. If the constraint does not exist, the query throws an error, unless `IF EXISTS` is specified.

See more on [constraints](/reference/statements/create/table#constraints).

Queries will add, change or remove metadata about constraints from table, so they are processed immediately.

<Tip>
  Constraint check **will not be executed** on existing data if it was added or modified.
</Tip>

All changes on replicated tables are broadcast to ZooKeeper and will be applied on other replicas as well.
