Example
Convert a degree value into radians:
SELECT RADIANS(180);
Definition and Usage
The RADIANS() function converts a degree value into radians.
Convert a degree value into radians:
SELECT RADIANS(180);
The RADIANS() function converts a degree value into radians.
Return 4 raised to the second power:
SELECT POWER(4, 2);
The POWER() function returns the value of a number raised to the power of another number.
Return 4 raised to the second power:
SELECT POW(4, 2);
The POW() function returns the value of a number raised to the power of another number.
POW(x, y)
Parameter | Description |
---|---|
x | Required. A number (the base) |
y | Required. A number (the exponent) |
Works in: | From MySQL 4.0 |
---|
Return 8 raised to the third power:
SELECT POW(8, 3);
Return the value of PI:
SELECT PI();
The PI() function returns the value of PI.
Return the remainder of 18/4:
SELECT MOD(18, 4);
The MOD() function returns the remainder of a number divided by another number. Continue reading MySQL MOD Function
Find the price of the cheapest product in the “Products” table:
SELECT MIN(Price) AS SmallestPrice FROM Products;
The MIN() function returns the minimum value in a set of values.
Note: See also the MAX() function. Continue reading MySQL MIN Function
Find the price of the most expensive product in the “Products” table:
SELECT MAX(Price) AS LargestPrice FROM Products;
The MAX() function returns the maximum value in a set of values.
Return the base-2 logarithm of 6:
SELECT LOG2(6);
The LOG2() function returns the natural logarithm of a number to base-2.
Return the base-10 logarithm of 2:
SELECT LOG10(2);
The LOG10() function returns the natural logarithm of a number to base-10.
LOG10(number)
Parameter | Description |
---|---|
number | A number greater than 0 |
Works in: | From MySQL 4.0 |
---|
Return the base-10 logarithm of 4.5:
SELECT LOG10(4.5);
Return the natural logarithm of 2:
SELECT LOG(2);
The LOG() function returns the natural logarithm of a specified number, or the logarithm of the number to the specified base. Continue reading MySQL LOG Function