Orientdb 简明教程

OrientDB - Truncate Record

Truncate Record 命令用于删除特定记录的值。

Truncate Record command is used to delete the values of a particular record.

以下语句是截断命令的基本语法。

The following statement is the basic syntax of the Truncate command.

TRUNCATE RECORD <rid>*

其中 <rid> * 表示要截断的记录 ID。可以使用多个 Rids 并用逗号分隔它们来截断多个记录。它返回截断的记录数。

Where <rid>* indicates the Record ID to truncate. You can use multiple Rids separated by comma to truncate multiple records. It returns the number of records truncated.

Example

让我们考虑我们在上一章中使用的相同的客户表。

Let us consider the same Customer table that we have used in the previous chapter.

Sr.No.

Name

Age

1

Satish

25

2

Krishna

26

3

Kiran

29

4

Javeed

21

5

Raja

28

尝试使用以下查询来截断记录 ID 为 #11:4 的记录。

Try the following query to truncate the record having Record ID #11:4.

Orientdb {db = demo}> TRUNCATE RECORD #11:4

如果成功执行了以上查询,您会获得以下输出。

If the above query is executed successfully, you will get the following output.

Truncated 1 record(s) in 0.008000 sec(s).

要检查客户表中的记录,可以使用以下查询。

To check the record of Customer table you can use the following query.

Orientdb {db = demo}> SELECT FROM Customer

如果成功执行了以上查询,您会获得以下输出。

If the above query is executed successfully, you will get the following output.

----+-----+--------+----+-------+----
#   |@RID |@CLASS  |id  |name   |age
----+-----+--------+----+-------+----
0   |#11:0|Customer|1   |satish |25
1   |#11:1|Customer|2   |krishna|26
2   |#11:2|Customer|3   |kiran  |29
3   |#11:3|Customer|4   |javeed |21
----+-----+--------+----+-------+----