Delete
For this exercise let's pick an Account
to delete:
Let's imagine that one of our users decided to quit our
app and has requested that we completely delete their
account. The delete
command uses the same mechanism as select
to find the items to be deleted. Also, just
like insert
and update
, a delete
command can be
wrapped in "(...)" and used as an expression. Normally,
we might have used the id
to pick what needs to be
deleted, but in case of the Account
the username is
just as good, since it has an exclusive
constraint on
it, which guarantees that each username is unique:
Let's make sure that we've deleted the right Account
:
This next example shows how we can send some watchlist info in JSON format to a user who wants her account deleted but wishes to retain the info: