DELETE

DELETE – remove objects from a database.

[ WITH with-item [, ...] ]

DELETE expr

[ FILTER filter-expr ]

[ ORDER BY order-expr [direction] [THEN ...] ]

[ OFFSET offset-expr ]

[ LIMIT  limit-expr ] ;
WITH

Alias declarations.

The WITH clause allows specifying module aliases as well as expression aliases that can be referenced by the DELETE statement. See WITH block for more information.

DELETE ...

The entire DELETE ... statement is syntactic sugar for DELETE (SELECT ...). Therefore, the base expr and the following FILTER, ORDER BY, OFFSET, and LIMIT clauses shape the set to be deleted the same way an explicit SELECT would.

On successful completion, a DELETE statement returns the set of deleted objects.

Here’s a simple example of deleting a specific user:

Copy
WITH MODULE example
DELETE User
FILTER User.name = 'Alice Smith';

And here’s the equivalent DELETE (SELECT ...) statement:

Copy
WITH MODULE example
DELETE (SELECT User
        FILTER User.name = 'Alice Smith');
Light
Dark
System