In a relational database, you can use the
DELETE statement to delete one or more rows of data from a table as follows.
DELETE FROM UserHistory
WHERE user_id = '10100' and time_stamp = 1479265526;
In Table Store, you can use the DeleteRow API to delete only one row of data at a time as follows.
// Set primary keys
PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder();
PrimaryKey primaryKey = primaryKeyBuilder.build();
RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, primaryKey);
// Delete this row of data
- When using DeleteRow, you must specify the table name
TABLE_NAMEand all primary keys
- You can use the BatchDeleteRow API to delete multiple records, making your deletion operations faster.
- DeleteRow supports Condition check.
- In SQL, the
DELETEstatement deletes all records that satisfy the
WHEREcondition. 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.