The MySQL DEGREES() function converts an angle from radians to degrees. For example, PI() radians is equal to 180 degrees. You can run these examples directly in MySQL or phpMyAdmin without creating a table.
MySQL's PI() function supplies the value of π. Pass it to DEGREES() to obtain an angle in degrees.
SELECT DEGREES(PI()) AS angle_degrees;
Expected result:
| angle_degrees |
|---|
| 180 |
The result is 180 because a full half-turn is π radians, or 180 degrees. The number returned by MySQL does not include the degree symbol.
DEGREES(X)
Here, X is a number expressing an angle in radians. Conceptually, the conversion is:
degrees = radians × 180 / π
For example, PI() / 2 radians represents 90 degrees. If the argument is NULL, DEGREES(NULL) also returns NULL.
These queries cover the original PI(), PI()/2 and PI()/3 examples, plus rounding and a missing value. You can execute each SELECT statement independently.
SELECT DEGREES(PI()); -- 180
SELECT DEGREES(PI() / 2); -- 90
SELECT DEGREES(PI() / 3); -- approximately 60
SELECT ROUND(DEGREES(1), 2); -- approximately 57.30
SELECT DEGREES(NULL); -- NULL
| Radian input | Result in degrees | Explanation |
|---|---|---|
PI() | 180 | Half-turn |
PI()/2 | 90 | Quarter-turn |
PI()/3 | Approximately 60 | Floating-point result may show additional digits |
1 | Approximately 57.30 | Rounded to two decimal places using ROUND() |
NULL | NULL | Missing input remains missing |
MySQL uses floating-point values in these calculations, so an unrounded result may show a small precision difference. Use ROUND() when you need an easier-to-read display value.
Use DEGREES() when your input is in radians and you need degrees. For the opposite conversion, use RADIANS().
SELECT DEGREES(PI() / 2) AS degrees_value;
SELECT RADIANS(90) AS radians_value;
The first query returns 90 degrees; the second returns approximately 1.5707963267949 radians. Converting back is especially useful when working with SQL expressions that use trigonometric functions such as SIN() and COS(), which expect radians.
DEGREES(90) treats 90 as radians, not degrees. For an input of 90 degrees, use RADIANS(90) instead.ROUND() when appropriate.Is a database table needed to try DEGREES()?
No. All examples on this page use standalone SELECT expressions and can be run directly in a SQL console or phpMyAdmin.
What does DEGREES(NULL) return?
It returns NULL because the input is unknown.
Can DEGREES() convert 45 degrees into radians?
No. Use RADIANS(45) for that conversion.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.