# Update statement · Chromia Docs (concept)

> You can use operators @, @?, @*, @+ to specify cardinality, like for the at-operator.

Source: https://docs.chromia.com/rell/language-features/database/update/

# Update statement

You can use operators `@`, `@?`, `@*`, `@+` to specify cardinality, like for the at-operator. A run-time error occurs if
the number of updated records doesn't match the cardinality.

Rell

```
update user @ { .name == 'Bob' } ( company = 'Microsoft' ); // exactly one
update user @? { .name == 'Bob' } ( deleted = true ); // zero or one
update user @* { .company.name == 'Bad Company' } ( salary -= 1000 ); // any number
```

Can change only `mutable` attributes.

You can match entity attributes implicitly by name or type:

Rell

```
val company = 'Microsoft';
update user @ { .name == 'Bob' } ( company );
```

Using multiple entities with aliases. The first entity is the one that's updated. You can use other entities in the
where-part:

Rell

```
update (u: user, c: company) @ { u.xyz == c.xyz, u.name == 'Bob', c.name == 'Google' } ( city = 'Seattle' );
```

Can specify an arbitrary expression returning a entity, a nullable entity, or a collection of entities:

Rell

```
val u = user @? { .name == 'Bob' };
update u ( salary += 5000 );
```

You can modify a single attribute by a regular assignment syntax:

Rell

```
val u = user @ { .name == 'Bob' };
u.salary += 5000;
```

[View this page on docs.chromia.com](https://docs.chromia.com/rell/language-features/database/update/)Content mirrored from the live docs
