SQL Arithmetic Operators (Addition, Subtraction, Multiplication, Division)

In sql, arithmetic operators are used to perform a mathematical operations like addition ( ), subtraction (-), multiplication (*), division (/), module (%) on sql statements. In sql, we have a different type of arithmetic operators available, those are 

 

  • SQL Addition (+) Operator
  • SQL Subtraction (-) Operator
  • SQL Multiplication (*) Operator
  • SQL Division (/) Operator
  • SQL Modulus (-) Operator

SQL Addition (+) Operator

In sql, addition operator are used to perform an addition of numbers .

 

Example:

 

Following is the example of using addition operator in sql server.

 

Select 17+5 

If we execute above sql query, we will get the result as 22.

SQL Subtraction (-) Operator

In sql, subtraction operator is used to perform a subtraction of numbers.

 

Example:

 

Following is the example of using subtraction operator in sql server.

 

Select 17-5

If we execute above sql query, we will get the result as 12.

SQL Multiplication (*) Operator

In sql, multiple operator is used to perform multiplication of numbers.

 

Example

 

Following is the example of using a multiplication operator in sql server.

 

Select 17*5

If we execute above sql query, we will get the result as 85.

SQL Division (/) Operator

In sql, division operator is used to perform a division of numbers.

 

Example:

 

Following is the example of using a division operator in sql server.

 

Select 17/5

If we execute above sql query, we will get the result as 3.

SQL Modulus (%) Operator

In sql, modulus operator is used to perform a division of numbers and returns a remainder of division operation.

 

Example:

 

Following is the example of using a modulus operator in sql server.

 

Select 17%3

If we execute above sql query, we will get the result as 2.

 

For more information related to arithmetic operators, check following information.

 

OperatorDescriptionExample
+ (Addition) By using this operator we can perform addition of numbers. 17 + 5 = 22
- (Subtraction) By using this operator we can perform subtraction of numbers. 17 – 5 = 12
* (Multiplication) By using this operator we can perform multiplication of numbers. 17 * 5 = 85
/ (Division) By using this operator we can perform division of numbers. 17 / 5 = 3
% (Modulus) This operator returns remainder of a division operation. 17 % 5 = 2