Home

Topics
Basic Select statements
Select Columns
Arithmetic Expressions
NULL Manipulation
Column Aliases
Concatenation
Duplicates
More SQL in our Forum

Arithmetic operations in SQL( +, -, /, * ):

We can do mathematical operations in SQL, please follow the symbols. Here oracle comes with a table called DUAL. which is used mainly for mathematical operations, this table have one row and one column we can say them as virtual. DUAL. is a virtual table which is used for all kinds of Arithmetic operations in SQL.

Arithmetic Operation Arithmetic Operation Explanation
+
Used for addition in SQL
*
Used for Mulitplication in SQL
/
Used for division in SQL
-
Used for Subtraction in SQL

Arithmetic Addition in SQL:

  • Select Salary, (salary+100) ,(salary+1000),(salary+5000) from employees
  • select (100+100) from DUAL

Arithmetic subtraction in SQL:

  • Select Salary, (salary-100) ,(salary-1000),(5000-salary) from employees
  • select (100-100) from DUAL

Arithmetic Multiplication in SQL:

  • Select Salary, (salary*100) ,(salary*1000),(salary*5000) from employees
  • select (100*100) from DUAL

Arithmetic Division in SQL:

  • Select Salary, (salary/100) ,(salary/1000),(salary/5000) from employees
  • select (100/100) from DUAL

You can do all kinds of Arithmetics combinations in this.

  • select (100+Salary)*200 ,salary,(salary-commission_pct) ,( (Salary+commission_pct) /0.100) from employees

 
www.iforerunner.com