Back to Blog

SQL Add - How to Use Addition in SQL Server - SQL Training Online

Perform mathematical operations with SQL addition operator. Learn numeric calculations, column arithmetic, and aggregate functions in queries.

2 min read

Last updated on

The SQL Add (+), or the Addition operator is used to add to numbers and days to a date. In this video, you will see how to use it inside of SQL Server Management Studio.

[/sharebox5_no_text]

I first want to take a look at the Employee table in the SQL Training Online Simple Database.

select * from employee


In particular, I want to look at the Salary and Commission columns.
![SQL Add (+), SQL Addition](../../assets/blog/2012/10/image_thumb.png)

We can add those two columns together by using the plus sign (+), or addition operator in SQL:

select salary

,commision ,salary + commision

from employee

But, since there can be nulls in the commission column, we need to handle that with the isnull function:

select salary

,isnull(commision,0) as commision

,salary + isnull(commision,0) as total_compensation

from employee

Next, I want to show you how to add with a datetime.

When you use the SQL Add operator, SQL Server will actually add the number in days.

Here is an example:

select hire_date

,hire_date + 2 as training_date

from employee

This example will add 2 days to the hire_date. MSDN also esplains the SQL Add operator.

Let me know what you think by commenting or sharing on twitter, facebook, google+, etc.

About Joey Blue

Joey Blue teaches practical data skills that companies actually use. With 25+ years of experience solving real data problems for Fortune 500 companies, he's helped 152,000+ students learn SQL, Power BI, reporting, and modern analytics—cutting straight to what works.