SQL | Arithmetic Operators
                                        
                                                                                    
                                                
                                                    Last Updated : 
                                                    12 Aug, 2025
                                                
                                                 
                                                 
                                             
                                                                             
                                                             
                            
                            
                                                                                    
                Arithmetic operators in SQL are used to perform mathematical operations on table data. These operators help in calculating totals, differences, percentages, and other numeric transformations directly in queries.
These operations can be applied to:
- A single column
- Two or more columns
- Constant values with column data
List of Arithmetic Operators in SQL
| Operator | Description | 
|---|
| + | Addition | 
| - | Subtraction | 
| / | Division | 
| * | Multiplication | 
| % | Modulus (Remainder) | 
1. Addition (+)
The addition operator is used to sum values. Performs addition between:
- Column and constant
- Two columns
Example 1: Addition with constant
SELECT employee_id, employee_name, salary, 
       salary + 100 AS "salary + 100"
FROM addition;
Output:
| employee_id | employee_name | salary | salary+100 | 
|---|
| 1 | Alex | 25000 | 25100 | 
| 2 | RR | 55000 | 55100 | 
| 3 | JPM | 52000 | 52100 | 
| 4 | GGSHMR | 12312 | 12412 | 
Example 2: Addition of two columns
SELECT employee_id, employee_name, salary, 
       salary + employee_id AS "salary + employee_id"
FROM addition;
Output:
| employee_id | employee_name | salary | salary+employee_id | 
|---|
| 1 | Alex | 25000 | 25001 | 
| 2 | RR | 55000 | 55002 | 
| 3 | JPM | 52000 | 52003 | 
| 4 | GGSHMR | 12312 | 12316 | 
2. Subtraction (-)
The subtraction operator deducts one value from another. Performs subtraction between:
- Column and constant
- Two columns
Example 1: Subtracting a constant
SELECT employee_id, employee_name, salary, 
       salary - 100 AS "salary - 100"
FROM subtraction;
Output:
| employee_id | employee_name | salary | salary-100 | 
|---|
| 12 | Finch | 15000 | 14900 | 
| 22 | Peter | 25000 | 24900 | 
| 32 | Warner | 5600 | 5500 | 
| 42 | Watson | 90000 | 89900 | 
Example 2: Subtracting one column from another
SELECT employee_id, employee_name, salary, 
       salary - employee_id AS "salary - employee_id"
FROM subtraction;
Output:
| employee_id | employee_name | salary | salary-employee_id | 
|---|
| 12 | Finch | 15000 | 14988 | 
| 22 | Peter | 25000 | 24978 | 
| 32 | Warner | 5600 | 5568 | 
| 42 | Watson | 90000 | 89958 | 
3. Multiplication (*)
The multiplication operator multiplies values by constants or other column values. It multiplies:
- Column and constant
- Two columns
Example 1: Multiplying with a constant
SELECT employee_id, employee_name, salary, 
       salary * 100 AS "salary * 100"
FROM addition;
Output:
| employee_id | employee_name | salary | salary*100 | 
|---|
| 1 | Finch | 25000 | 2500000 | 
| 2 | Peter | 55000 | 5500000 | 
| 3 | Warner | 52000 | 5200000 | 
| 4 | Watson | 12312 | 1231200 | 
Example 2: Multiplying two columns
SELECT employee_id, employee_name, salary, 
       salary * employee_id AS "salary * employee_id"
FROM addition;
Output:
| employee_id | employee_name | salary | salary*employee_id | 
|---|
| 1 | Finch | 25000 | 25000 | 
| 2 | Peter | 55000 | 110000 | 
| 3 | Warner | 52000 | 156000 | 
| 4 | Watson | 12312 | 49248 | 
5. Division (/)
The division operator divides one value by another. Example for division is similar to multiplication but returns quotient instead of product.
Example:
SELECT employee_id, employee_name, salary, 
       salary / 100 AS "salary / 100"
FROM addition;
Output:
| employee_id | employee_name | salary | salary/100 | 
|---|
| 1 | Finch | 25000 | 250 | 
| 2 | Peter | 55000 | 550 | 
| 3 | Warner | 52000 | 520 | 
| 4 | Watson | 12312 | 123.12 | 
6. Modulus (%)
The modulus operator returns the remainder of a division. 
Useful for:
- Even/Odd check
- Pattern-based calculations
Example 1: Modulus with constant
SELECT employee_id, employee_name, salary, 
       salary % 25000 AS "salary % 25000"
FROM addition;
Output:
| employee_id | employee_name | salary | salary%25000 | 
|---|
| 1 | Finch | 25000 | 0 | 
| 2 | Peter | 55000 | 5000 | 
| 3 | Warner | 52000 | 2000 | 
| 4 | Watson | 12312 | 12312 | 
Example 2: Modulus between columns
SELECT employee_id, employee_name, salary, 
       salary % employee_id AS "salary % employee_id"
FROM addition;
Output:
| employee_id | employee_name | salary | salary%employee_id | 
|---|
| 1 | Finch | 25000 | 0 | 
| 2 | Peter | 55000 | 0 | 
| 3 | Warner | 52000 | 1 | 
| 4 | Watson | 12312 | 0 | 
7. Arithmetic Operations with NULL
When any arithmetic operation is performed on a NULL value, the result is always NULL.
Example:
SELECT employee_id, employee_name, salary, type, 
       type + 100 AS "type + 100"
FROM addition;
Output: 
| employee_id | employee_name | salary | type | type+100 | 
|---|
| 1 | Finch | 25000 | NULL | NULL | 
| 2 | Peter | 55000 | NULL | NULL | 
| 3 | Warner | 52000 | NULL | NULL | 
| 4 | Watson | 12312 | NULL | NULL | 
 Key Notes on NULL:
- NULLmeans unknown/unavailable
- It is not the same as 0or empty string
- Any operation with NULLresults inNULL
                                                    
                                                
                                                        
                            
                        
                                                
                        
                                                                                    
                                                                Explore
                                    
                                        SQL Tutorial
                    
                    6 min read
                
Basics
Queries & Operations
SQL Joins & Functions
Data Constraints & Aggregate Functions
Advanced SQL Topics
Database Design & Security