H I O X INDIA
MySQL Tutorial
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Mysql Tutorial
Introduction
How to Install
Database
Datatypes
Tables
INSERT
SELECT
UPDATE
DELETE
Operators
Functions
Ask Your Doubts
Feedback





Numeric functions


Topic

Numeric functions in MySQL.
How to use Math Functions?



Explanation


Mathematical Functions :

    Now lets see some Math functions with an example.

ROUND(X), ROUND(X,D) :

    Returns the argument X, rounded to the nearest integer. If it contains two arguments, then returns X rounded to D decimal places.

mysql> select round(12.589);
 -->  13

mysql> select round(-12.23);
 -->  -12

mysql> select round(5.258, 1);
 -->  5.3

mysql> select round(5.258, -1);
 -->  10
SIGN(X) :

    Returns the sign of the given number as -1 if negative,0 if zero, or 1 if positive.
mysql> select sign(-89);
 -->  -1

mysql> select sign(0);
 -->  0

mysql> select sign(123);
 -->  1
SIN(X) :

    Returns the sine value of X,X given in radians.
mysql> select sin(45);
 -->   0.85090352453412

mysql> select sin(pi());
 -->  1.2246063538224e-016
SQRT(X) :

    Returns the square root of the number,the number should be a positive number.
mysql> select sqrt(144);
 -->   12

mysql> select sqrt(741);
 -->  27.221315177632
TAN(X) :

    Returns the tangent of X, where X is given in radians.
mysql> select tan(45);
 -->   1.6197751905439

mysql> select sqrt(90);
 -->  -1.9952004122082
TRUNCATE(X,D) :

    The number is truncated to D digits after decimal point. If D is negative, the D digits before the decimal point are converted to 0.
mysql> select truncate(4.556,1);
 -->   4.5

mysql> select truncate(444.556,-1);
 -->  440




others


        MySQL is the most popular open source database Management system. Being a open source anyone can use and change the software for their needs. Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this MySQL tutorial. This is a copyright content.


privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Other Links