In MySQL, the DEGREES()
function converts a value from radians to degrees, and returns the result.
You provide the radian value as an argument when calling the function.
Syntax
The syntax goes like this:
DEGREES(X)
Where X
is the radian value for which you’d like to have converted to degrees.
Example 1 – Basic Usage
Here’s a basic example.
SELECT DEGREES(1);
Result:
+-------------------+ | DEGREES(1) | +-------------------+ | 57.29577951308232 | +-------------------+
And here’s another example using a different radian value.
SELECT DEGREES(2);
Result:
+--------------------+ | DEGREES(2) | +--------------------+ | 114.59155902616465 | +--------------------+
Example 2 – Passing in a Function
Here’s an example where I pass in the PI()
function.
SELECT DEGREES(PI());
Result:
+---------------+ | DEGREES(PI()) | +---------------+ | 180 | +---------------+
Example 3 – Expressions
You can also pass in expressions like this:
SELECT DEGREES(PI() / 4);
Result:
+-------------------+ | DEGREES(PI() / 4) | +-------------------+ | 45 | +-------------------+
Convert From Degrees to Radians
If you need to convert the other way, see MySQL RADIANS() Function – Convert From Degrees to Radians.