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 clause allows specifying module aliases as well
as expression aliases that can be referenced by the
statement. See WITH block for more information.
The entire DELETE ... statement is syntactic
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:
WITH MODULE example DELETE User FILTER User.name = 'Alice Smith';
And here’s the equivalent
DELETE (SELECT ...) statement:
WITH MODULE example DELETE (SELECT User FILTER User.name = 'Alice Smith');