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

  Total Views : 562
  Comments : 0
 
  Keywords : What are the arithmetic operators in sql server, How to use arithmetic operators in sql server, Types of sql arithmetic operators with examples, SQL arithmetic operators like addition

Here we will learn what are the arithmetic operators in sql server and uses of arithmetic operators in sql server and different types of arithmetic operators in sql server with examples.

SQL Arithmetic Operators

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

 

      - SQL Addition ( ) Operator

 

      - SQL Subtraction (-) Operator

 

      - SQL Multiplication (*) Operator

 

      - SQL Division (/) Operator

 

      - SQL Modulus (-) Operator

SQL Addition ( ) Operator

By using SQL addition operator we can do addition of numbers 

 

Example:

 

Following is the example to use addition operator in sql server

 

Select 17 5 

If we run above sql query it will return result 22

SQL Subtraction (-) Operator

By using SQL subtraction operator we can do subtraction of numbers

 

Example:

 

Following is the example to use subtraction operator in sql server

 

Select 17-5

If we run above sql query it will return result 12

SQL Multiplication (*) Operator

By using SQL multiple operator we can do multiplication of numbers

 

Example

 

Following is the example to use multiplication operator in sql server

 

Select 17*5

If we run above sql query it will return result 85

SQL Division (/) Operator

By using this SQL operator we can do division of numbers

 

Example:

 

Following is the example to use division operator in sql server

 

Select 17/5

If we run above sql query it will return result 3

SQL Modulus (%) Operator

The modulus operator in SQL will perform division of numbers and returns remainder of division operation

 

Example:

 

Following is the example to use modulus operator in sql server

 

Select 17%3

If we run above sql query it will return result 2

 

For more information related to arithmetic operators check below information

 

Operator

Description

Example

(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

 

 Comments (0)

Be the first to give your valuable feedback

Leave a comment

  • Default Tutlane User