How to use Arithmetic Operators in MySQL

Notes:

How to use Arithmetic Operators in MySQL:

+: Addition Operator : sum of two numbers
- : Subtraction Operator : difference between two numbers
*: Multiplication Operator : product of two numbers
/: Floating-point Division Operator : quotient of the division operation as floating point value
div: Integer Division Operator : integer part of the quotient
% or mod: Modulus Operator : remainder of the first division operation

Example Code:
select 10 + 2; // 12

select 10 - 2; // 8

select 10 * 2; // 20

select 10 / 2; // 5.000
select 10 div 2; // 5

select 11 / 2; // 5.500
select 11 div 2; // 5

select 10 % 2; // 0
select 11 % 2; // 1

select 10 mod 2; // 0
select 11 mod 2; // 1

update tbl_faculty set salary = salary * 2 where id = 2;
update tbl_faculty set salary = salary - 2000 where id = 3;

Interview Questions: