SQL Arithmetic Operator Examples(ADD/MUL/DIV/SUB/MOD)

A-Z of Mircrosoft SQL

Main Page Introduction SSMS Acronym's used in SQL SQL Commands SQL Functions SQL Store Procedures SQL Views SQL Triggers SQL Operators SQL - Adding Comments SQL Alias SQL Joins SQL - Building Basic Scripts SQL - Execution Plan Questions or Suggestions
H1B Jobs- Visual Reports

SQL Examples

Arithmetic Operators Comparision Operators Logical Operators Bitwise Operators String Functions Date Functions Numeric Functions





Examples on how we use these Operators

Here are some Screenshots with real time results of how you can use the Operators. If used in correct way , they can help is powerful SQL transformations , data mining , data analysis.

We will use [AdventureWorks2012].[Person].[Person] table for this Operator

SQL ADDITION Operator

Addition(+) operator add two values on left and right, this can be used ad a Concatenation operator as well.

Notice the column names 'Fullname' and 'Values Addition' to get an idea.

We will use [AdventureWorks2012].[Person].[Person] table for this Operator

SQL SUBTRACTION Operator

Subtraction(-) operator subtractions two values on left from the right.

Notice the column 'Values Addition' to get an idea.

We will use [AdventureWorks2012].[Person].[Person] table for this Operator

SQL MULTIPLICATION Operator

Multiplication(*) operator multiplies two values on left and the right.

Notice the column 'Values Addition' , compare it to column 3,4 to get an idea.

We will use [AdventureWorks2012].[Person].[Person] table for this Operator

SQL DIVISION Operator

Division(/) operator divides two values - left value over right value.

Notice the column 'Values Addition' , compare it to column 3,4 to get an idea. Notice how we use where clause to make sure denominator does not have 0.

We will use [AdventureWorks2012].[Person].[Person] table for this Operator

SQL MODULUS Operator

Modulus(%) operator divides two values - left value over right value and gives the remiander.

Notice the column 'Values Addition' , compare it to column 3,4 to get an idea. Notice how we use where clause to make sure denominator does not have 0.

Next Stop: Comparision Operators