Orientdb 简明教程
OrientDB - Delete Vertex
Delete Vertex 命令用于从数据库中删除顶点。在删除时,它将检查并维护与边的连贯性,并删除指向已删除顶点的所有交叉引用(与边)。
Delete Vertex command is used to remove vertices from the database. While deleting, it checks and maintains the consistency with the edges and removes all cross-references (with the edges) to the deleted vertex.
以下语句是删除顶点命令的基本语法。
The following statement is the basic syntax of Delete Vertex Command.
DELETE VERTEX <vertex> [WHERE <conditions>]
[LIMIT <MaxRecords>>] [BATCH <batch-size>]
以下是上文中选项的详细信息。
Following are the details about the options in the above syntax.
<vertex> - 使用类、记录 ID 或子查询定义要删除的顶点。
<vertex> − Defines the vertex that you want to remove, using its Class, Record ID, or through a sub-query.
WHERE - 过滤条件,用于确定命令删除哪些记录。
WHERE − Filters condition to determine which records the command removes.
LIMIT - 定义要删除的最大记录数。
LIMIT − Defines the maximum number of records to be removed.
BATCH - 定义命令一次删除多少条记录,允许将大事务分解成小块,以节省内存使用量。
BATCH − Defines how many records the command removes at a time, allowing you to break large transactions into smaller blocks to save on memory usage.
Example
试试以下命令来学习如何删除单个顶点或多个顶点。
Try the following command to learn how to delete single vertex or multiple vertices.
执行以下命令,删除顶点 ‘#14:1’。
Execute the following command to remove the vertex ‘#14:1’.
orientdb> DELETE VERTEX #14:1
如果上述命令执行成功,您将获得以下输出内容。
If the above command is executed successfully, you will get the following output.
Delete record(s) '1' in 0.005000 sec(s)
执行以下命令,删除所有标记为 ‘isSpam’ 属性的类 ‘Customer’ 中的顶点。
Execute the following command to remove all vertices from the class ‘Customer’ marked with the property ‘isSpam’.
orientdb> DELETE VERTEX Customer WHERE isSpam = TRUE
如果上述命令执行成功,您将获得以下输出内容。
If the above command is executed successfully, you will get the following output.
Delete record(s) '3' in 0.005000 sec(s)