Removes one or more records from the database.
You can refine the set of records that it removes using the WHERE
clause.
Syntax:
DELETE FROM <Type>|BUCKET:<bucket>|INDEX:<index> [RETURN <returning>]
[WHERE <Condition>*] [LIMIT <MaxRecords>] [TIMEOUT <MilliSeconds>] [UNSAFE]
-
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. -
UNSAFE
no use, is kept only for compatibility with OrientDB SQL and it could be removed in the future versions of the SQL language.
Examples:
-
Delete all records with the surname
unknown
, ignoring case:
ArcadeDB> DELETE FROM Profile WHERE surname.toLowerCase() = 'unknown'
-
Delete all records of the type
Document
, due to an improper JSON import, or record creation command (note the use of the backticks):
ArcadeDB> DELETE FROM `Document`