MariaDB DEGREES() Function

In MariaDB, DEGREES() is a built-in function that converts a given radian value to degrees and return the result.

If you need to convert degrees to radians, use the RADIANS() function. See also the PI() function.

MariaDB DEGREES() Syntax

Here is the syntax of the MariaDB DEGREES() function:

DEGREES(number)

Parameters

number

Required. A number representing radians.

If you provide the wrong number of parameters, MariaDB will report an error: ERROR 1582 (42000): Incorrect parameter count in the call to native function 'DEGREES'.

Return value

The MariaDB DEGREES() function returns the degree value for a given radian value.

If the parameter is NULL, the DEGREES() function will return NULL.

If the parameter is non-numeric, the DEGREES() function will return 0.

MariaDB DEGREES() Examples

Basic example

This statement shows the basic usage of the MariaDB DEGREES() function:

SELECT DEGREES(1.25);

Output:

+------------------+
| DEGREES(1.25)    |
+------------------+
| 71.6197243913529 |
+------------------+

0 radians

0 radian equals 0 degree, as the following statement demonstrates:

SELECT DEGREES(0);

Output:

+------------+
| DEGREES(0) |
+------------+
|          0 |
+------------+

π radians

π (pi) radians are equal to 180 degrees, and the following statement demonstrates this:

SELECT DEGREES(PI());

Output:

+---------------+
| DEGREES(PI()) |
+---------------+
|           180 |
+---------------+

In this example, the PI() function is used to get the value of π.

Conclusion

In MariaDB, DEGREES() is a built-in function that converts a given radian value to degrees and the result.