> For the complete documentation index, see [llms.txt](https://clear.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clear.gitbook.io/project/model/batchs-operations/bulk-update.md).

# Bulk update

## Bulk update

Any simple query can be transformed to `update` query. The new update query will use the `where` clause as parameter for the update.

```ruby
User.query.where(name =~ /[A-Z]/ ).
     to_update.set(name: Clear::SQL.unsafe("LOWERCASE(name)")).execute
```

## Bulk delete

Same apply for DELETE query.

```ruby
User.query.where(name !~ /[A-Z]/ ).
     to_delete.execute
```

{% hint style="warning" %}
Beware: Bulk update and delete do not trigger any model lifecycle hook. Proceed with care.
{% endhint %}
