INSERT and UPDATE
statements using the IF clause, support lightweight transactions, also known as
Compare and Set (CAS).
Register a new user.
INSERT INTO users (login, email, name, login_count)
VALUES ('jdoe', 'firstname.lastname@example.org', 'Jane Doe', 1)
IF NOT EXISTS
Perform a CAS operation against a row that does exist by adding the predicate
for the operation at the end of the query. For example, reset Jane Doe's
SET email = ‘email@example.com’
WHERE login = 'jdoe'
IF email = ‘firstname.lastname@example.org’