Delete​

delete – remove objects from a database.

  1. [ with with-item [, ...] ]
  2. delete expr
  3. [ filter filter-expr ]
  4. [ order by order-expr [direction] [then ...] ]
  5. [ offset offset-expr ]
  6. [ 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.

Output​

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

Examples​

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

  1. with module example
  2. delete User
  3. filter User.name = 'Alice Smith';

And here’s the equivalent delete (select ...) statement:

  1. with module example
  2. delete (select User
  3. filter User.name = 'Alice Smith');

See also

EdgeQL > Delete

Cheatsheets > Deleting data