content_image/668178.jpg content_image/668179.jpg
<img src='content_image/668178.jpg'>

-> 1 

## Note 

If the PIPES_AS_CONCAT  SQL mode is enabled, ||  signifies the SQL-standard string concatenation operator (like CONCAT() ). 

The || , operator is a nonstandard MySQL extension. As of MySQL 8.0.17, this operator is deprecated; expect support for it to be removed in a future version of MySQL. Applications should be adjusted to use the standard SQL OR  operator. Exception: Deprecation does not apply if PIPES_AS_CONCAT  is enabled because, in that case, ||  signifies string concatentation. 

• XOR 

Logical XOR. Returns NULL  if either operand is NULL . For non- NULL  operands, evaluates to 1  if an odd number of operands is nonzero, otherwise 0  is returned. 

mysql> SELECT 1 XOR 1; -> 0 mysql> SELECT 1 XOR 0; -> 1 mysql> SELECT 1 XOR NULL; -> NULL mysql> SELECT 1 XOR 1 XOR 1; -> 1 

a XOR b  is mathematically equal to (a AND (NOT b)) OR ((NOT a) and b) . 

## 12.4.4 Assignment Operators 

<img src='content_image/668179.jpg'>

• := 

Assignment operator. Causes the user variable on the left hand side of the operator to take on the value to its right. The value on the right hand side may be a literal value, another variable storing a value, or any legal expression that yields a scalar value, including the result of a query (provided that this value is a scalar value). You can perform multiple assignments in the same SET  statement. You can perform multiple assignments in the same statement. 

Unlike = , the :=  operator is never interpreted as a comparison operator. This means you can use :=  in any valid SQL statement (not just in SET  statements) to assign a value to a variable. 

mysql> SELECT @var1, @var2; -> NULL, NULL mysql> SELECT @var1 := 1, @var2; -> 1, NULL mysql> SELECT @var1, @var2; -> 1, NULL mysql> SELECT @var1, @var2 := @var1; -> 1, 1 mysql> SELECT @var1, @var2; -> 1, 1 

