Commands
DELETE
Use the DELETE
command to permanently remove rows from a table.
INFO
Call FLUSH after DELETE
to persist the changes to storage. This ensures that the changes are committed and visible for subsequent reads.
Syntax
Parameters
Parameter or clause | Description |
---|---|
table_name | The table where you want to remove records. |
WHERE condition | Specify which rows you want to remove using an expression that returns a boolean value. Rows for which this expression returns true will be removed. If you omit the WHERE clause, all rows of records in the table will be deleted but the table structure will be kept. |
RETURNING | Returns the values of any column based on each deleted row. |
Example
The taxi_trips
table has three records:
The following statement removes the record with id 3 from the table. Also, it returns the value of id for the deleted row.
The following statement removes all rows from the table.
Let’s see the result.
Was this page helpful?