MySQL, increment/decrement an existing value

MySQL offers a fast way to increment a value in a table without first obtaining it:

UPDATE table SET counter=counter+1 WHERE id=1

the same syntax applies to decrementing:

UPDATE table SET counter=counter-1 WHERE id=1



Google+