For SET , either = or := can be used as the assignment operator. User variables can be assigned a value from a limited set of data types: integer, decimal, floating-point, binary or nonbinary string, or NULL value. Assignment of decimal and real values does not preserve the precision or scale of the value.
SET var _name = value enables you to assign values to variables that affect the operation of the server or clients. SET Syntax for Variable Assignment”.
SET CHARACTER SET and SET NAMES assign values to character set and collation variables associated with the current connection to the server. The maximum length of the user-defined variable is characters as of MySQL 5. The user-defined variables are not case-sensitive. MySQL SELECT INTO multiple variables example To store values from the select list into multiple variables , you separate variables by commas. How to assign a value to a variable in MySQL? How do I set a variable in SQL?
What is a variable in MySQL?
First lets take a look at how can we define a variable in mysql. Now, how to assign a value in a variable in mysql.