| Home | Sign up! | Projects | Seminars | Research Notes | Today's Lecture | About |

Update Research Note Form
 Course: Research Note Topic: Research Note Description:
Number Functions in SQL
• ABS(data): Returns the absolute value of data (i.e. positive value).
SQL>SELECT ABS(-5000) FROM DUAL; =5000
• CEIL(data): Returns the smallest integer greater than or equal to data.
SQL>SELECT CEIL(123.55) FROM DUAL; =124
• FLOOR(data): Returns the largest integer less than or equal to data.
SQL>SELECT FLOOR(123.55) FROM DUAL; =123
• LN(data): Returns the natural algorithm of data.
• LOG(b,data): Returns the base 'b' logarithm of data.
• MOD(data,Y): Returns the modulus of dividing data by Y.
SQL>SELECT MOD(101,2) FROM DUAL; =1
• POWER(data,Y): Returns the data raised to the POWER of Y.
SQL>SELECT POWER(2,4) FROM DUAL; =16
• ROUND(data,n): Where n is the number of decimal places to which the data is rounded.
SQL>SELECT ROUND(123.55), ROUND(123.55,1) FROM DUAL; 124                          123.6
• SQRT(data): Returns the square root of data.
SQL>SELECT SQRT(64) FROM DUAL; =8
• TRUNC(data,n): Where n is the number of decimal places for truncation.
SQL>SELECT TRUNC(123.55,0), TRUNC(123.55,1) FROM DUAL; 123                 123.5