SQL - ARITHMETIC OPERATOR

Опубликовано: 04 Август 2026
на канале: Fratello Innotech
2
0

SQL - Arithmetic Operators
Definition

Arithmetic Operators in SQL are special symbols used to perform mathematical calculations on numeric data stored in database tables. They help users calculate totals, differences, products, quotients, and remainders directly within SQL queries.

Arithmetic Operators in SQL
Addition (+)

Used to add two values.

SELECT salary + bonus AS total_salary
FROM employee;
Subtraction (-)

Used to subtract one value from another.

SELECT salary - deduction AS net_salary
FROM employee;
Multiplication (*)

Used to multiply two values.

SELECT quantity * price AS total_amount
FROM products;
Division (/)

Used to divide one value by another.

SELECT total_marks / subjects AS average_marks
FROM student;
Modulus (%)

Used to find the remainder after division.

SELECT 25 % 4;
Key Points
Arithmetic operators work with numeric data types.
They can be used in SELECT, WHERE, and ORDER BY clauses.
They help perform calculations without exporting data from the database.
Arithmetic expressions can be combined with column values and constants.
Results can be displayed using aliases with the AS keyword.