# SQL Arithmetic Operators

The SQL Arithmetic Operators are used to perform SQL Server Arithmetic operations, such as Addition, Subtraction, Multiplication, and Division on given Data.

## SQL Arithmetic Operators Example

Before we get into the example, the following table shows the list of available Arithmetic operators in SQL Server.

For this SQL Server Arithmetic Operators demo, We are going to use the below-shown data

The SQL Server Addition Operator is useful in multiple ways. If we use the addition operator on Numerical data, then it will add those values and provide the integer output. If we used the SQL + operator in between two strings, then it will combine them and provide string output.

For example, the following SQL Arithmetic Operators query will combine the [EnglishProductName] and [Color] columns

```SELECT [EnglishProductName] + ' - ' + [Color] AS [Product Name]
,[StandardCost]
,[DealerPrice]
,[SalesAmount]
,[TaxAmt]
FROM [Product Sales]```

NOTE: ‘-‘ is added between the product name and color

Let us see, How to perform Addition on Numerical Data in Sql Server. For example, We want to increase the standard cost of each product then we can use this addition operator to add the constant value.

```SELECT [EnglishProductName]
,[Color]
,[StandardCost] + 2.25 AS [New Standard Cost]
,[DealerPrice]
,[SalesAmount]
,[TaxAmt]
FROM [Product Sales]```

Above SQL Addition Operator Query is adding 2.25 to the standard cost of every product present in the Product Sales table

## SQL – Operator ( Subtraction )

The SQL Subtract Operator is used to subtract one value from the other. For example, The following SQL – operator query will calculate the Profit Margin by subtracting the standard cost from the dealer price.

```SELECT [EnglishProductName]
,[Color]
,[StandardCost]
,[DealerPrice]
,[DealerPrice] - [StandardCost] AS [Product Margin]
,[SalesAmount]
,[TaxAmt]
FROM [Product Sales]```

## SQL * Operator (Multiplication)

The SQL Multiplication Operator is used to Multiply one value with the other. For example, the SQL * arithmetic operator in the following query will calculate the Tax for late payments.

```SELECT [EnglishProductName]
,[Color]
,[StandardCost]
,[DealerPrice]
,[SalesAmount]
,[TaxAmt] * 2 AS [Double Taxation]
FROM [Product Sales]```

In this SQL Server example, we are multiplying the original Tax amount with 2.

## SQL / Operator (Division)

The SQL Division Operator is used to Divide one value with the other. For example, The following SQL Arithmetic division Operator query will calculate the percentage of Tax we are paying for each product.

```SELECT [EnglishProductName]
,[Color]
,[StandardCost]
,[DealerPrice]
,[SalesAmount]
,[TaxAmt]
,[SalesAmount] / [TaxAmt] AS [Tax Percent]
FROM [Product Sales]```
Categories SQL