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. If it fails, a part of the rows might be deleted and another part might remain in the table.

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.

You must provide a table_name parameter.

Parameter Description Example

table_name

The table name to delete rows from.

WHERE condition

An optional clause that, if given, indicates the conditions that rows must satisfy to be deleted. condition is an expression that is evaluated for each row. If the expression is true, the row is selected. If there’s no WHERE clause, all rows will be deleted.

Examples

This section lists some example SQL queries that show you how to use the DELETE statement.

Delete Entries by Keys or Values

Currently, only IMap mappings support deleting rows.

For example, in a map that contains Employee objects as values with the following structure:

Name

Type

startDate

INT

amount

INT

title

STRING

department

STRING

You can delete the entries based on the 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: