Open In App

SQL | Arithmetic Operators

Last Updated : 12 Aug, 2025
Comments
Improve
Suggest changes
38 Likes
Like
Report

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

OperatorDescription
+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_idemployee_namesalarysalary+100
1Alex2500025100
2RR5500055100
3JPM5200052100
4GGSHMR1231212412

Example 2: Addition of two columns

SELECT employee_id, employee_name, salary, 
salary + employee_id AS "salary + employee_id"
FROM addition;

Output:

employee_idemployee_namesalarysalary+employee_id
1Alex2500025001
2RR5500055002
3JPM5200052003
4GGSHMR1231212316

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_idemployee_namesalarysalary-100
12Finch1500014900
22Peter2500024900
32Warner56005500
42Watson9000089900

Example 2: Subtracting one column from another

SELECT employee_id, employee_name, salary, 
salary - employee_id AS "salary - employee_id"
FROM subtraction;

Output:

employee_idemployee_namesalarysalary-employee_id
12Finch1500014988
22Peter2500024978
32Warner56005568
42Watson9000089958

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_idemployee_namesalarysalary*100
1Finch250002500000
2Peter550005500000
3Warner520005200000
4Watson123121231200

Example 2: Multiplying two columns

SELECT employee_id, employee_name, salary, 
salary * employee_id AS "salary * employee_id"
FROM addition;

Output:

employee_idemployee_namesalarysalary*employee_id
1Finch2500025000
2Peter55000110000
3Warner52000156000
4Watson1231249248

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_idemployee_namesalarysalary/100
1Finch25000250
2Peter55000550
3Warner52000520
4Watson12312123.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_idemployee_namesalarysalary%25000
1Finch250000
2Peter550005000
3Warner520002000
4Watson1231212312

Example 2: Modulus between columns

SELECT employee_id, employee_name, salary, 
salary % employee_id AS "salary % employee_id"
FROM addition;

Output:

employee_idemployee_namesalarysalary%employee_id
1Finch250000
2Peter550000
3Warner520001
4Watson123120

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_idemployee_namesalarytypetype+100
1Finch25000NULLNULL
2Peter55000NULLNULL
3Warner52000NULLNULL
4Watson12312NULLNULL

Key Notes on NULL:

  • NULL means unknown/unavailable
  • It is not the same as 0 or empty string
  • Any operation with NULL results in NULL

Article Tags :

Explore