---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ydb.tech/docs/en/dev/yql-tutorial/update.md?version=v25.3
  - https://ydb.tech/docs/ru/dev/yql-tutorial/update.md?version=v25.3
  - href: en/dev/yql-tutorial/update.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/core/dev/yql-tutorial/update.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Updating data with UPDATE

Update data in the table using the [UPDATE](https://ydb.tech/docs/en/yql/reference/syntax/update.md?version=v25.3) operator:

<!-- source: en/dev/yql-tutorial/_includes/yql_tutorial_prerequisites.md -->
{% note info %}

We assume that you already created tables in step [Creating a table](https://ydb.tech/docs/en/dev/yql-tutorial/create_demo_tables.md?version=v25.3) and populated them with data in step [Adding data to a table](https://ydb.tech/docs/en/dev/yql-tutorial/fill_tables_with_data.md?version=v25.3).

{% endnote %}
<!-- endsource: en/dev/yql-tutorial/_includes/yql_tutorial_prerequisites.md -->

```yql
UPDATE episodes
SET title="test Episode 2"
WHERE
    series_id = 2
    AND season_id = 5
    AND episode_id = 12
;

COMMIT;

-- View result:
SELECT * FROM episodes WHERE series_id = 2 AND season_id = 5;

-- YDB doesn't see changes that take place at the start of the transaction,
-- which is why it first performs a read. You can't UPDATE or DELETE a table
-- already changed within the current transaction. UPDATE ON and
-- DELETE ON let you read, update, and delete multiple rows from one table
-- within a single transaction.

$to_update = (
    SELECT series_id,
           season_id,
           episode_id,
           Utf8("Yesterday's Jam UPDATED") AS title
    FROM episodes
    WHERE series_id = 1 AND season_id = 1 AND episode_id = 1
);

SELECT * FROM episodes WHERE series_id = 1 AND season_id = 1;

UPDATE episodes ON
SELECT * FROM $to_update;

COMMIT;

-- View result:
SELECT * FROM episodes WHERE series_id = 1 AND season_id = 1;

COMMIT;
```

