DELETE command in Amazon QLDB - Amazon Quantum Ledger Database (Amazon QLDB)

DELETE command in Amazon QLDB

In Amazon QLDB, use the DELETE command to mark an active document as deleted in a table by creating a new, but final revision of the document. This final revision indicates that the document is deleted. This operation ends the lifecycle of a document, which means that no further document revisions with the same document ID can be created.

This operation is irreversible. You can still query the revision history of a deleted document by using the History function.


To learn how to control access to run this PartiQL command on specific tables, see Getting started with the standard permissions mode in Amazon QLDB.


DELETE FROM table_name [ AS table_alias ] [ BY id_alias ] [ WHERE condition ]



The name of the user table containing the data to be deleted. DML statements are only supported in the default user view. Each statement can only run on a single table.

AS table_alias

(Optional) A user-defined alias that ranges over a table to be deleted from. The AS keyword is optional.

BY id_alias

(Optional) A user-defined alias that binds to the id metadata field of each document in the result set. The alias must be declared in the FROM clause using the BY keyword. This is useful when you want to filter on the document ID while querying the default user view. For more information, see Using the BY clause to query document ID.

WHERE condition

The selection criteria for the documents to be deleted.


If you omit the WHERE clause, then all of the documents in the table are deleted.

Return value

documentId – The unique ID of each document that you deleted.


DELETE FROM VehicleRegistration AS r WHERE r.VIN = '1HVBBAANXWH544237'

Running programmatically using the driver

To learn how to programmatically run this statement using the QLDB driver, see the following tutorials in Getting started with the driver: