Use own variables in query MySQL


It is very easy to use variables for MySQL statements possible in MYSQL. These must be defined with the SET function and the @-prefix:

SET @a= 'a';

And can then be used for the duration of the DB session:

UPDATE my_table SET x = @a WHERE y = @a;