# Complete Guide to SQL Math Operators

SQL math operators are easy to use and very powerful. They can help you to perform advanced analytics and calculations within your queries. We’ve put together this helpful guide to assist you in learning the various mathematical operations you can perform.

For any given SQL math operation, you should keep in mind that the data type and NULL values will impact how the database performs the calculation. Each article below will provide examples of these situations for the specific operator.

## Types of SQL Math Operators

There are three primary categories of operations that we cover:

1. Basic math operators: addition, subtraction, multiplication, and division
2. Math functions: functions built into the database for absolute values, exponents, square roots, and other advanced operations
3. Aggregate functions: SUM(), MAX(), MIN(), AVG() and other aggregation functions

## SQL Code for Math Operators Guide

In order to help you work through each of the tutorials below, we’ve provided sample code to create the table and perform the initial inserts required. The code is available publicly on Github for each database platform that we cover in the tutorials.

## Basic Math Operations

These are all basic SQL math operators that work fairly consistently in all database servers such as MS SQL Server, MySQL, and PostgreSQL. These operations can be used on literal values, database fields, variables, and even in combination with aggregate functions.

### How to Add in SQL

A common question for people learning to write SQL code for the first time is how to add in SQL. Fortunately, it's a very simple process, but there are some things to be aware of when performing mathematical...

### How to Divide in SQL

Are you ready to learn how to divide in SQL? We've already covered how to multiply in SQL and add in SQL . Now it's time to expand our skillset. Performing division in SQL is just as easy, but there...

### How to Multiply in SQL

Learning how to multiply in SQL is very easy and fast. SQL allows you to use basic mathematical operators in your queries. You can use fields within a table in your calculations as well as literal values....

### How to Subtract in SQL

Ready to learn how to subtract in SQL? The great news is that it's just as easy as performing other mathematical operations in SQL. It might be the easiest operation altogether. Basic Subtraction...

## Aggregate SQL Functions

Aggregate functions allow you to perform operations against multiple rows in your query.

### How to Calculate the Average in SQL

If you need to calculate the average in SQL of a particular column's values, built-in aggregate functions are the solution. Fortunately, all of the major database platforms will provide you with built-in...

### How to Sum in SQL

One of the most basic things you need to know how to do when beginning to writing SQL queries is how to sum in SQL. This is the process of taking a result set and adding up the values of all the records...