Loading

MySQL Compound Operators

MySQL Compound Operators are used to perform the operation specified by the additional operator, then assign the result to the left operand. In other words, it executes some operation and set an original value to the result of the operation.

Add equals(+=):- Syntax will be
SELECT column1+=column2 FROM TableName;
For Example:- Select (age+=10) from Employeetable;
It will increment the age of the employee
Subtract equals(-=):-Syntax will be
SELECT column1-=column2 FROM TableName;
For example:-
Select (age-=10) from Employeetable;
It will decrement the age of the employee

Multiply equals(*=):-Syntax will be
SELECT column1*=column2 FROM TableName;
For example:-
Select (age*=10) from Employeetable;
It will multiply the age of the employee

Divide equals(/=):-Syntax will be
SELECT column1/=column2 FROM TableName;
For example:-
Select (age/=10) from Employeetable;
It will divide the age of the employee

Modulo equals(%=):-Syntax will be
SELECT column1%=column2 FROM TableName;
For example:-
Select (age%=10) from Employeetable;
It will send a reminder of the age of the employee after division
Bitwise AND equals(&=):-Syntax will be
SELECT column1&=column2 FROM TableName;
Bitwise exclusive equals(^-=):-Syntax will be
SELECT column^-=column2 FROM TableName;
Bitwise OR equals(|*=):-Syntax will be
SELECT column |*=column2 FROM TableName;

Read also:-

MySQL Arithmetic Operators Example

MySQL Bitwise Operators

MySQL Comparison Operators

MySQL Comparison Functions

MySQL String Comparison Operator Functions

MySQL Logical Operators

For more detail about operators please check the Manual

Share with:


Leave a Reply

Connect with:

z35W7z4v9z8w
Verified by ExactMetrics