DELETE FROM

Warning

At the moment, YDB's compatibility with PostgreSQL is under development, so not all PostgreSQL constructs and functions are supported yet. PostgreSQL compatibility is available for testing in the form of a Docker container, which can be deployed by following these instructions.

Syntax of the DELETE FROM statement:

DELETE FROM <table name>
WHERE <column name><condition><value/range>;

To delete a row from a table based on a specific column value, the construction DELETE FROM <table name> WHERE <column name><condition><value/range> is used.

Warning

Note that the use of the WHERE ... clause is optional, so when working with DELETE FROM it is very important to avoid accidentally executing the command before specifying the WHERE ... clause.

Note

Unlike PostgreSQL, YDB uses optimistic locking. This means that transactions check the conditions for the necessary locks at the end of their operation, not at the beginning. If the lock has been violated during the transaction's execution, such a transaction will end with a Transaction locks invalidated error. In this case, you can try to execute a similar transaction again.