H I O X INDIA
MySQL Tutorial
Google
Web hscripts.com
 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





Mathematical/Math functions


Topic

Numeric functions in MySQL.
What are the Math/Mathematical Functions?



Explanation


Mathematical Functions :

    Now lets see some Mathematical functions with an example.

LOG2(X) :

    Returns the base-2 logarithm of X.

mysql> select log2(7215);
 -->  12.816783679379

mysql> select log2(-10);
 -->  NULL
LOG10(X) :

    Returns the base-10 logarithm of X.
mysql> select log10(5);
 -->  0.69897000433602

mysql> select log10(-5);
 -->  NULL
MOD(N,M), N % M, N MOD M :

    This function returns the remainder of N divided by M.
mysql> select mod(123, 10);
 -->  3

mysql> select 111 % 8;
 -->  7

mysql> select 45 mod 4;
 -->  1
PI() :

    Returns the value of Π(pi).
mysql> select pi();
 -->  3.141593
POW(X,Y), POWER(X,Y) :

    This function returns the value of XY.
mysql> select pow(3,4);
 -->  81

mysql> select pow(3,-4);
 -->  0.012345679012346
RADIANS(X) :

    This function returns the argument X, converted from degrees to radians.
mysql> select radians(30);
 -->  0.5235987755983

mysql> select radians(45);
 -->  0.78539816339745
RAND(X) :

    This function returns the random floating point number between 0 & 1. If a number is given within this function ,it produces repeatable sequence of values.
mysql> select rand();
 -->  0.13388662052703

mysql> select rand(10);
 -->  0.65705152196535

mysql> select rand(10);
 -->  0.65705152196535

mysql> select rand();
 -->  0.82382530888899

mysql> select rand();
 -->  0.7174667135975

mysql> select rand(10);
 -->  0.65705152196535




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