headlines
DELETE
Syntax
Use DELETE statements to remove
information from the database. The possible elements of a
DELETE statement include:
pql_statement |
::= |
DELETE FROM
|
Description
The elements of a DELETE statement are defined as follows:
DELETE FROM |
Removes data from the database in the form of one or more
trees or sub-trees. In PQL, the FROM keyword is
required. The DELETE FROM clause must include a
path. The path indicates the
location of the anchor-point node. Deleting a node also deletes any history for that node. | |
WHERE |
Limits the number of sub-trees over which the statement operates
by applying a boolean_expression
to specify the conditions.If you do not qualify the DELETE FROM statement with
a WHERE clause, the entire named tree is deleted.
|
Examples
Example #1
The following statement removes interfaces named 'eth0' from
your network:
DELETE FROM /network/device/interface WHERE name = 'eth0'
The statement starts with the DELETE FROM keywords, followed by
the path /network/device/interface indicating where to find the
node to be removed. The statement includes a WHERE clause with a
boolean_expression
that specifies that only interfaces named 'eth0' should be removed.
If you run this statement against the
sample database,
you'll get the following results, the red text indicating
the 'eth0' interfaces that have been deleted:
row
*
network
device
system
name 5627
computed_vendor LANIER
computed_model 5627
computed_class printer
computed_score 115
os
version LANIER 5627 5.20
interface
name eth0
mac_address 01:01:02:03:04:05
in_octets 1995335536
out_octets 248342455
oper_status 1
device
system
name ESMITH
computed_vendor Intel
computed_class server
computed_score 10
os
version Linux
interface
name eth0
mac_address 02:A1:A2:A3:A4:A4
in_octets 1229592351
out_octets 1472928781
oper_status 1
interface
name eth1
mac_address 03:A1:A2:A3:A4:A5
in_octets 0
out_octets 0
oper_status 0
device
system
name AJONES
computed_vendor Intel
computed_class server
computed_score 10
os
version Linux
interface
name eth0
mac_address 04:A1:A2:A3:A4:A8
in_octets 1223098455
out_octets 1523093749
oper_status 1
interface
name eth1
mac_address 05:A1:A2:A3:A4:A9
in_octets 0
out_octets 0
oper_status 0
device
system
computed_model Ethernet Switch
computed_class switch
computed_score 25
os
version Ethernet Switch
interface
name eth0
mac_address 06:13:72:F3:0A:F5
in_octets 0
out_octets 0
oper_status 2
interface
name eth1
mac_address 07:13:72:F3:0A:F6
in_octets 0
out_octets 0
oper_status 2
device
system
name KRYPTON
computed_model Windows Workstation
computed_class workstation
computed_score 125
os
version Darwin Kernel Version 9.2.2
interface
name eth0
mac_address 08:16:CB:FF:FE:66
in_octets 0
out_octets 346
oper_status 1
interface
name eth1
mac_address 09:16:CB:FF:FE:67
in_octets 0
out_octets 0
oper_status 2
interface
name eth2
mac_address 10:16:CB:FF:FE:68
in_octets 0
out_octets 0
oper_status 2
interface
name eth3
mac_address 11:16:CB:FF:FE:69
in_octets 1598233842
out_octets 2360815490
oper_status 1
device
system
name NISSINGETTY
computed_vendor Juniper Networks
computed_model Netscreen Router
computed_class router
computed_score 60
os
version NetScreen-5GT 5.1.043a
interface
name eth0
mac_address 12:10:D8:99:2B:C2
in_octets 1385354750
out_octets 1451321493
oper_status 1
interface
name eth1
mac_address 13:10:D8:99:2B:C1
in_octets 3312952833
out_octets 3239791359
oper_status 1
Example #2
The following statement removes the entire interface and everything below it:
DELETE FROM /network/device/interface
If you run this statement against the sample database, you'll get the following results with all interfaces entirely removed:
row
*
network
device
system
name 5627
computed_vendor LANIER
computed_model 5627
computed_class printer
computed_score 115
os
version LANIER 5627 5.20
device
system
name ESMITH
computed_vendor Intel
computed_class server
computed_score 10
os
version Linux
device
system
name AJONES
computed_vendor Intel
computed_class server
computed_score 10
os
version Linux
device
system
computed_model Ethernet Switch
computed_class switch
computed_score 25
os
version Ethernet Switch
device
system
name KRYPTON
computed_model Windows Workstation
computed_class workstation
computed_score 125
os
version Darwin Kernel Version 9.2.2
device
system
name NISSINGETTY
computed_vendor Juniper Networks
computed_model Netscreen Router
computed_class router
computed_score 60
os
version NetScreen-5GT 5.1.043a

