T .delete()

Read(144) Label: delete, table sequence, record,

Description:

Delete specified records from a table sequence.

Syntax:

T.delete(k)

Delete the kth record

T.delete(p)

Delete the records whose sequence numbers exist in p

T.delete(A)

Delete the records that exist in A

Note:

The function deletes the specified records from table sequence T, and automatically updates the index, if any, and checks distinctness. The deleted records will be always saved in the delete buffer.

Parameters:

T

A table sequence

k

A positive integer, which specifies the position of a record to be deleted

p

An integer sequence with the length of n, which specifies the positions of the records to be deleted

A

A sequence, which specifies the records to be deleted

Options:

  @n  Return the deleted record or a record sequence of the deleted records

Return value:

The table sequence T, some records of which have been deleted

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE")

 

2

=A1.delete(1)

Delete the first record

3

=A1.delete([2,4,6])

Delete the second, the forth and the sixth records.

4

=A1.select(EID>5)

 

5

=A1.delete(A4)

Delete the records whose EID is more than 5.

6

=A1.delete@n(1)

Return the deleted record

Note:

We use the store address, instead of the field names or field values, to judge whether the records specified by A exist in T. So to delete the specified records , we generally use the function T.delete(T.select(…)) to locate them.

Related functions:

T.modify()

T.insert()

A.delete()