Previous Next JavaScript must be enabled to correctly display this content

## delete

Encapsulates commands that delete key/value pairs from store or rows from table. The subcommands are as follows:

- delete kv

- delete table

### delete kv

    delete kv [-key <key>] [-start prefixString] [-end prefixString] [-all]

Deletes one or more keys. If `-all` is specified, delete all keys starting at the specified key. If no key is specified, delete all keys in the store. The `-start` and `-end` flags can be used for restricting the range used for deleting.

For example, to delete all keys in the store starting at root:

    kv -> delete kv -all
    301 Keys deleted starting at root

### delete table

    kv-> delete table -name <table_name>
     [-field <name> -value <value>]*
     [-field <name> [-start <value>] [-end <value>]]
     [-ancestor <name>]* [-child <child_name>]*
     [-json <string>] [-delete-all]

Deletes one or multiple rows from the named table.

- `-name`

  Identifies a table name, which can be any of the following:

  - `table_name` – The target table is a top level table created in the default namespace, `sysdefault`. The default namespace (`sysdefault:`) prefix is not required to identify such tables.
  - `table_name.child_name` – The target table is the child of a parent table. Identify the child table by preceding it with the parent `table_name`, followed by a period (.) separator before `child_name`.
  - `namespace_name:table_name` – The target table was not created in the default (`sysdefault`) namespace. Identify `table_name` by preceding it with its `namespace_name`, followed by a colon (:).
  - `namespace_name:table_name.child_name` – The target table is the child of a parent table that was created in a namespace. Identify `child_name` by preceding it with both `namespace_name:` and the parent `table_name`, , followed by a period (.) separator.

- `-field` and `-value`

  Pairs specify the field values of the primary key or, use an empty key to delete all rows from the table.

- `-field` , `-start`, and `-end`

  Use these flags to restrict the sub-range for deletion associated with the parent key.

- `-ancestor` and `-child`

  Use to delete rows from a specific ancestor or descendant tables, in addition to the target table.

- `-json`

  Indicates that the key field values are in JSON format.

- `-delete-all`

  Indicates to delete all rows in a table.