DELETE
- reference
DELETE immediately removes the specified document from your keyspace.
Prerequisites
RBAC Privileges
To execute the DELETE statement, you must have the Query Delete privilege granted on the target keyspace. If the statement has any RETURNING clauses that need data read, then the Query Select privilege is also required on the keyspaces referred in the respective clauses. For more details about user roles, see Authorization.
Syntax

target-keyspace | |
use-keys-clause | |
where-clause | |
limit-clause | |
returning-clause |
Delete Target

Specifies the data source from which to delete the document.
keyspace-ref | |
alias |
Keyspace Reference



Keyspace reference for the delete target. For more details, refer to Keyspace Reference.
AS Alias
Assigns another name to the keyspace reference. For details, refer to AS Clause.
Assigning an alias to the keyspace reference is optional.
If you assign an alias to the keyspace reference, the AS
keyword may be omitted.
Delete Hint
You can use a USE KEYS
hint on the delete target to specify the keys of the data items to be deleted.
For details, refer to USE KEYS Clause.
LIMIT Clause

Specifies the greatest number of objects that can be deleted. This clause must have a non-negative integer as its upper bound. Optional.
RETURNING Clause

Specifies the information to be returned by the operation as a query result. For more details, refer to RETURNING Clause.
Examples
To try the examples in this section, set the query context to the inventory
scope in the travel sample dataset.
For more information, see Query Context.
Please note that running the following examples will permanently delete your sample data.
To restore your sample data, remove and reinstall the travel-sample bucket.
Refer to Sample Buckets for details.
|
This example requires the Query Delete privilege on airport
and the Query Select privilege on `beer-sample`
.
This example requires the Query Delete and Query Select privileges on airport
.