MySQL DEGREES() Function: Convert Radians to Degrees

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.

DEGREES() with PI(): First SQL Example

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.

On this page — Show page sectionsHide page sections

DEGREES() Syntax and Formula

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.

More MySQL DEGREES() Examples

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 inputResult in degreesExplanation
PI()180Half-turn
PI()/290Quarter-turn
PI()/3Approximately 60Floating-point result may show additional digits
1Approximately 57.30Rounded to two decimal places using ROUND()
NULLNULLMissing 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.

DEGREES() vs RADIANS()

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.

Common Mistakes

  • Passing degrees into DEGREES(): DEGREES(90) treats 90 as radians, not degrees. For an input of 90 degrees, use RADIANS(90) instead.
  • Expecting a degree symbol: The result is numeric. If you need a formatted value, add the degree symbol in your application or presentation layer.
  • Expecting every result to be an exact integer: Approximate floating-point results can contain extra decimal places; use ROUND() when appropriate.

Frequently Asked Questions

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.

↑ Back to top




Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer