DELETE
The DELETE
statement deletes map entries that match the condition in a given WHERE
clause.
This statement is not atomic and deletions are never rolled back. If this statement is canceled for any reason, some values that match the condition may be deleted and some may remain. |
Syntax Summary
This code block is a quick reference with all the parameters that you can use with the DELETE
statement.
See some practical examples.
DELETE FROM table_name [ [ AS ] alias ]
[ WHERE condition ]
Parameters
The DELETE
statement accepts the following parameters.
Most of these parameters are optional, but you must provide an expression
parameter and a from_item
parameter.
Parameter | Description | Example |
---|---|---|
|
An optional clause that, if given, indicates the conditions that rows must satisfy to be selected. |
Examples
This section lists some example SQL queries that show you how to use the DELETE
statement.
Delete Entries by Keys or Values
You can delete map entries by key or value.
For example, in a map that contains Employee
objects as values with the following structure:
Name |
Type |
|
|
|
|
|
|
|
|
You can delete the entries of the Employee.age
field where the age is less than 18:
DELETE FROM employees WHERE age < 18;
Whether you can access nested fields like this in objects depends on how your map entries are serialized:
-
For Java objects (
Serializable
,DataSerializable
,IdentifiedDataSerializable
), you must add the object’s class to the classpath of the member you are sending the query to. -
For
Portable
/Compact(BETA)
objects, you do not need to add the object’s class to the classpath of the member, unless you want to use parameterized queries to compare one object against another.