Presto DELETE Statement Syntax
A DELETE statement is used to delete one or more rows in a table, depending on how many rows satisfy the search condition that you specify in the WHERE clause. The WHERE clause also helps reduce unintentional DELETE commands.
DELETE statements are helpful for:
- Cleaning up error records
- Removing duplicate records
- Removing unnecessary or unexpected results from result tables
A Presto DELETE of individual records from tables offers more flexibility than the td_partial_delete command.
DELETE FROM <table_name> [ WHERE <condition> ]
- <table_name> is the name of the table for deletion
- <condition> is the clause to specify a search condition
Delete all line items shipped by air:
DELETE FROM lineitem WHERE shipmode = 'AIR'
Delete all event logs from a July 1st, 2017 UTC:
DELETE FROM lineitem WHERE TD_TIME_RANGE(time, '2017-07-01','2017-07-02')