Commands delete and deleterange
Prerequisites
Before running following commands, create a target database or ensure that a database has been created. For details about how to create a database, see 2.
Procedure
- Go to the /home directory.
cd /home
- Run the scan command to view the existing data in the database.
ldb --db=/home/rocksdb/rkdb scan

- Use ldb to run the delete command to delete the values of a specified key.
ldb --db=/home/rocksdb/rkdb delete k5

- Run the get command to query the values of k5.
ldb --db=/home/rocksdb/rkdb get k5

- Use ldb to run the deleterange command to delete the values of keys in a specified range.
ldb --db=/home/rocksdb/rkdb deleterange k2 k4

- View the result after deletion.
ldb --db=/home/rocksdb/rkdb scan

Parent topic: Examples