Math functions in MySQL

MySQL mathematical functions let us calculate, round, convert and summarize numeric values directly in a query. Use them in SELECT expressions, calculations and conditions when the database should return a computed value.

SELECT ABS(-12.5) AS absolute_value, ROUND(18.567, 2) AS rounded_value, POW(2, 5) AS power_value;
Functions Description
ABS()Absolute value of a number
ACOSArc cos of the input
ASINArc sin of the input
ATANArc tan of the input
ATAN2Arc tan of two inputs
AVGWe can get the average value of a range of data by using avg function.
CEIL()Math ceil function to get lowest integer value.
CONV()Convert one base to another
COS()COS() function takes input in Radian
COT()COT() function takes input in Radian
COUNTCounting the number of records in a table with conditions
CRC32()CRC32() returns 32 bit unsigned value of a string
DEGREESConvert Radian value to Degree
EXPe raised to the power of X
FLOOR()Math floor function to get highest integer value.
LNLog of the number (Same as LOG())
LOGLog of the number with different Base value
LOG10Log of the number with fixed Base 10 value
LOG2Log of the number with fixed Base 2 value
MAXMaximum value from a field of MySQL table by using max command
MINMinimum value among records by using MIN Query
ModGetting the remainder of a division and using in our Query
PI()PI() value with different functions
POW()Power of a number & creating a square table
RADIANS()Converting Degree to Radians in our Query
RAND()Generate a pseudo-random floating-point value
ROUND()Rounded to decimals
SIGNSign of the argument
SINSin of a radian input
SUMOur query can return sum of numeric data present in a record
TANTan of a radian input
Second highestWe can display first and second highest number present in table by using limit and order by commands
Data formatGetting the formatted output from MySQL table by using format query.
SQRT()Square root of number
TRUNCATE()Converting to fixed decimal value
STDDEV()Standard Deviation
VARIANCE()Variance
Find out non-numeric values present in a Column by using CONCAT

Practice Questions




Subscribe to our YouTube Channel here



plus2net.com
mohamed

24-07-2014

iwant learn math using php and mysql




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer