edit-icon download-icon

Delete data

Last Updated: Mar 01, 2018


In a relational database, you can use the DELETE statement to delete one or more rows of data from a table as follows.

  1. DELETE FROM UserHistory
  2. WHERE user_id = '10100' and time_stamp = 1479265526;

Table Store

In Table Store, you can use the DeleteRow API to delete only one row of data at a time as follows.

  1. // Set primary keys
  2. PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder();
  3. primaryKeyBuilder.addPrimaryKeyColumn("user_id", PrimaryKeyValue.fromString("10100"));
  4. primaryKeyBuilder.addPrimaryKeyColumn("time_stamp", PrimaryKeyValue.fromLong(1479265526));
  5. PrimaryKey primaryKey = primaryKeyBuilder.build();
  6. RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, primaryKey);
  7. // Delete this row of data
  8. client.deleteRow(new DeleteRowRequest(rowDeleteChange));


  • When using DeleteRow, you must specify the table name TABLE_NAME and all primary keys primaryKey.
  • You can use the BatchDeleteRow API to delete multiple records, making your deletion operations faster.
  • DeleteRow supports Condition check.
  • In SQL, the DELETE statement deletes all records that satisfy the WHERE condition. Table Store’s DeleteRow API only deletes the required row of data with the specified primary key. The condition check function only checks the primary key and attribute columns of this row.
Thank you! We've received your feedback.