Math functions in MySQL
We can use various mathematical functions available in MySQL queries to handle data. We can combine these functions with other SQL operations to perform complex calculations within our queries.
Find out non-numeric values present in a Column by using CONCAT
|ABS||Absolute value of a number|
|ACOS||Arc cos of the input|
|ASIN||Arc sin of the input|
|ATAN||Arc tan of the input|
|ATAN2||Arc tan of two inputs|
|AVG||We 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|
|COUNT||Counting the number of records in a table with conditions|
|CRC32()||CRC32() returns 32 bit unsigned value of a string|
|DEGREES||Convert Radian value to Degree|
|EXP||e raised to the power of X |
|FLOOR||Math floor function to get highest integer value. |
|LN||Log of the number (Same as LOG())|
|LOG||Log of the number with different Base value|
|LOG10||Log of the number with fixed Base 10 value|
|LOG2||Log of the number with fixed Base 2 value|
|MAX||Maximum value from a field of MySQL table by using max command|
|MIN||Minimum value among records by using MIN Query |
|Mod||Getting the reminder 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|
|ROUND||Rounded to decimals|
|SIGN||Sign of the argument|
|SIN||Sin of a radian input|
|SUM||Our query can return sum of numeric data present in a record|
|TAN||Tan of a radian input|
|Second highest||WE can display first and second highest number present in table by using limit and order by commands|
|Data format||Getting the formatted output from MySQL table by using format query.|
|sqrt||Square root of number |
|TRUNCATE||Converting to fixed decimal value|
|STDDEV()||Standard Deviation |
- Retrieve the absolute value of the difference between two numbers: 16 and -35.
- Calculate the square root of the average of the numbers 35, 29, and 84.
- Round the number 11.8765 to two decimal places.
- Calculate the value of 2 raised to the power of 7.
- Find the remainder when 27 is divided by 4.
- Generate a random decimal number between 10 and 50.
- Calculate the natural logarithm of 100.
- Round down the number 15.9 to the nearest integer.
- Calculate the value of e (Euler's number) raised to the power of 3.
- Find the ceiling value of the result of dividing 47 by 5.
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
|iwant learn math using php and mysql|