Loading
SQL Airthmetic Operators
In SQL, operators are special keywords or symbols used to perform operations on data stored in relational databases.



Types of SQL Operators

  • Arithmetic Operators – Perform mathematical operations
  • Comparison Operators – Compare values (=, >, <, etc.)
  • Logical Operators – Combine multiple conditions (AND, OR, NOT)
  • Set Operators – Combine result sets (UNION, INTERSECT)
  • Unary Operators – Work with a single operand (IS NULL, IS NOT NULL)
  • Bitwise Operators – Perform bit-level operations (&, |, ^, etc.)



SQL Arithmetic Operators

These operators are used to perform basic mathematical operations on numeric values in SQL tables.


OperatorDescription
+Addition - Adds two values
-Subtraction - Subtracts one value from another
*Multiplication - Multiplies values
/Division - Divides one value by another
%Modulus - Returns the remainder after division



Student Table

IDPhysicsChemistry
1018692
1028591
1037398



Example: SQL Query to Add Marks

SELECT Physics + Chemistry AS Total_Marks FROM student;

Output:

Total_Marks
178
176
171

Explanation: This query adds the values in the Physics and Chemistry columns for each student and returns it as Total_Marks.



Key Point

  • SQL arithmetic operators work directly within SELECT statements.
  • You can also use them in UPDATE queries to compute new values.
  • Useful for generating derived/calculated columns on the fly.