A newer version of Hazelcast Platform is available.

View latest

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

WHERE condition

An optional clause that, if given, indicates the conditions that rows must satisfy to be selected. condition is an expression that is evaluated for each row. If the expression is true, the row is selected. This expression is evaluated before grouping.

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

startDate

integer

amount

integer

title

string

department

string

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: