Deleting Apache Iceberg Tables
The DELETE command deletes rows from a table.
{{< codeheader "Syntax" >}}
DELETE FROM <table_path>.<table_name> [AS alias]
[ USING <additional_table_or_query> [, <additional_table_or_query> ] ]
[ WHERE where_conditions ]
Parameters
{{< sql-section file="data/sql/apache-iceberg-tables.json" data="deleting" >}}
Example
{{< codeheader "Example DELETE command using USING and WHERE" >}}
DELETE FROM target
USING src b , (select k, min(v) v from src_new group by k having min(v) < 10) c
WHERE target.k = b.k and target.k = c.k;
For Dremio v22 and earlier:Example of an unsupported DELETE command Equivalent DELETE command using a correlated subquery
Join conditions are not supported in WHERE clauses. If you need to use a join condition, use a correlated subquery instead.
delete from orders
using returns
where orders.order_id = returns.order_id;
delete from orders
where exists(select 1 from returns where order_id = orders.order_id)