---
title: "UPDATE statement"
description: "The UPDATE statement modifies existing rows in a table, setting one or more column values for rows that match an optional WHERE condition."
canonical: "https://motherduck.com/glossary/update-statement/"
related:
  - title: "UPDATE | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/duckdb-sql-reference/duckdb-statements/update/"
  - title: "DuckLake Architecture Deep Dive"
    url: "https://motherduck.com/blog/ducklake-architecture-deep-dive/"
  - title: "DuckDB statements | MotherDuck Docs"
    url: "https://motherduck.com/docs/sql-reference/duckdb-sql-reference/duckdb-statements/"
gated_asset:
  title: "DuckLake: The Lakehouse Table Format"
  url: "https://motherduck.com/lp/ducklake-lakehouse-table-format-book-full/"
---

# UPDATE statement

> The UPDATE statement modifies existing rows in a table, setting one or more column values for rows that match an optional WHERE condition.

## Overview
`UPDATE` is one of the core DML statements, alongside `INSERT` and `DELETE`, for changing data already stored in a table. Its basic form sets new values for specified columns on every row matching a `WHERE` clause:

```sql
UPDATE orders
SET status = 'shipped', shipped_at = CURRENT_TIMESTAMP
WHERE order_id = 1042;
```

Omitting `WHERE` updates every row in the table, so it's worth double-checking the filter before running an `UPDATE` in production.

<glossary-callout guide="duckdb-cheatsheet-full" />

## Updating from another table
A common need is to update a table's values based on a join against another table — for example, refreshing denormalized totals from a source of truth. Standard SQL and most engines support an `UPDATE ... FROM` (or `UPDATE ... JOIN` in MySQL) form for this:

```sql
UPDATE orders o
SET customer_name = c.name
FROM customers c
WHERE o.customer_id = c.id;
```

## DuckDB specifics
DuckDB supports `UPDATE ... SET ... FROM ... WHERE ...` exactly as shown above, letting you update a table using values joined from one or more other tables or subqueries. DuckDB also supports a `RETURNING` clause, which returns the updated rows (post-update values) directly from the `UPDATE` statement — useful for verifying a change or feeding it into a downstream step without a separate `SELECT`:

```sql
UPDATE orders
SET status = 'cancelled'
WHERE order_id = 1042
RETURNING order_id, status, updated_at;
```

Because DuckDB is transactional, an `UPDATE` inside an explicit `BEGIN ... COMMIT` block is atomic and can be rolled back if a later statement in the same transaction fails.