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

# Deleting data

Delete data from the table using [DELETE](https://ydb.tech/docs/en/yql/reference/syntax/delete.md?version=v25.3).

<!-- 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
DELETE
FROM episodes
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. It is impossible to execute UPDATE or DELETE on
-- if the table was 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_delete = (
    SELECT series_id, season_id, episode_id
    FROM episodes
    WHERE series_id = 1 AND season_id = 1 AND episode_id = 2
);

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

DELETE FROM episodes ON
SELECT * FROM $to_delete;

COMMIT;

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

COMMIT;
```

