DELETE
Removes one or more records from the database. You can refine the set of records that it removes using the WHERE
clause.
NOTE: Don’t use
DELETE
to remove Vertices or Edges. Instead use theDELETE VERTEX
orDELETE EDGE
commands, which ensures the integrity of the graph.
Syntax:
DELETE FROM <Class>|CLUSTER:<cluster>|INDEX:<index> [LOCK <default|record>] [RETURN <returning>]
[WHERE <Condition>*] [LIMIT <MaxRecords>] [TIMEOUT <timeout>]
LOCK
Determines how the database locks the record between load and delete. It takes one of the following values:DEFAULT
Defines no locks during the delete. In the case of concurrent deletes, the MVCC throws an exception.RECORD
Defines record locks during the delete.
RETURN
Defines what values the database returns. It takes one of the following values:COUNT
Returns the number of deleted records. This is the default option.BEFORE
Returns the number of records before the removal.
WHERE
Filters to the records you want to delete.LIMIT
Defines the maximum number of records to delete.TIMEOUT
Defines the time period to allow the operation to run, before it times out.
Examples:
Delete all recods with the surname
unknown
, ignoring case:- orientdb>
DELETE FROM Profile WHERE surname.toLowerCase() = 'unknown'
- orientdb>
For more information, see SQL commands.