Console - DELETE
Remove one or more records from the database. You can determine which records get deleted using the WHERE clause.
Syntax
DELETE FROM <target-name> [LOCK <lock-type>] [RETURN <return-type>]
[WHERE <condition>*] [LIMIT <MaxRecords>] [TIMEOUT <timeout-value>]
<target-name>Defines the target from which you want to delete records. Use one of the following target names:<class-name>Determines what class you want to delete from.CLUSTER:<cluster-name>Determines what cluster you want to delete from.INDEX:<index-name>Determines what index you want to delete from.
LOCK <lock-type>Defines how the record locks between the load and deletion. It takes one of two types:DEFAULTOperation uses no locks. In the event of concurrent deletions, the MVCC throws an exception.RECORDLocks the record during the deletion.
RETURN <return-type>Defines what the Console returns. There are two supported return types:COUNTReturns the number of deleted records. This is the default return type.BEFOREReturns the records before the deletion.
WHERE <condition>Defines the condition used in selecting records for deletion.LIMITDefines the maximum number of records to delete.TIMEOUTDefines the time-limit to allow the operation to run before it times out.
NOTE: When dealing with vertices and edges, do not use the standard SQL
DELETEcommand. Doing so can disrupt graph integrity. Instead, use theDELETE VERTEXor theDELETE EDGEcommands.
Examples
Remove all records from the class
Profile, where the surname is unknown, ignoring case:orientdb>DELETE FROM Profile WHERE surname.toLowerCase() = 'unknown'
For more information on other commands, see SQL Commands and Console Commands.