Skip to content
Last updated

Deleting Rows From a Table

This article summarizes options for deleting row-level data from a Treasure Data table. The current best practice is to use the Presto DELETE command.

The Trino DELETE statement has several known limitations.

Prerequisites

  • Basic knowledge of Treasure Data, including the TD Toolbelt

  • Understanding of Trino​

Using Trino DELETE Statements on Console

Trino Delete enables you to issues DELETE statement queries against any table in Treasure Data.

Use the following syntax to isolate the row you want to delete and delete it:

DELETE FROM table_name [ WHERE condition ]

For example:

DELETE FROM emp WHERE name = 'beekeeper1'

Using Trino DELETE Statements on CLI

You can delete the specific time range using the Trino delete statement in TD Toolbelt:

td query -d example_db -w \
"DELETE FROM table WHERE TD_TIME_RANGE(time, '2024-01-01', '2024-01-02', 'PDT')"