Erase Record order is utilized to erase at least one records totally from the data set.
The accompanying assertion is the fundamental sentence structure of the Delete order.
DELETE FROM <Class>|cluster:<cluster>|index:<index>
[LOCK <default|record>]
[RETURN <returning>]
[WHERE <Condition>*]
[LIMIT <MaxRecords>]
[TIMEOUT <timeout>]
Following are the insights regarding the choices in the above language structure.
- LOCK − Specifies how to bolt the records among burden and update. We have two choices to indicate Default and Record.
- RETURN − Specifies an articulation to return rather than the quantity of records.
- Cutoff − Defines the greatest number of records to refresh.
- Break − Defines the time you need to permit the update run before it times out.
- Note − Don't utilize DELETE to eliminate Vertices or Edges since it impacts the trustworthiness of the diagram.
Example
Allow us to consider the Customer table.
Sr.No. | Name | Age |
---|---|---|
1 | Satish | 25 |
2 | Krishna | 26 |
3 | Kiran | 29 |
4 | Javeed | 21 |
Attempt the accompanying question to erase the record having id = 4.
orientdb {db = demo}> DELETE FROM Customer WHERE id = 4
On the off chance that the above question is executed effectively, you will get the accompanying yield.
Delete 1 record(s) in 0.008000 sec(s).
To check the record of Customer table you can utilize the accompanying question.
Orientdb {db = demo}> SELECT FROM Customer
On the off chance that the above question is executed effectively, you will get the accompanying yield.
----+-----+--------+----+-------+----
# |@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
----+-----+--------+----+-------+----