Lesson

MySQL DEGREES() Function

10 min reading
Free Course

MySQL DEGREES() Function: Converting Radians into Degrees

The DEGREES() function converts an angle measured in radians into degrees. Internally, MySQL multiplies the input by 180 / PI() and returns a DOUBLE value.

All trigonometric functions in MySQL—such as ASIN(), ACOS(), and ATAN2()—output angles in radians. Wrapping those results in DEGREES() turns raw math output into readable compass headings or UI labels.

Syntax

DEGREES(x)
  • x: Any numeric value or expression representing an angle in radians.

Practical Example

Suppose demo_employees stores robotics calibration offsets (tilt_radians) recorded by warehouse sensors. Technicians read angles in degrees, not radians, so your reporting query can display both the raw sensor reading and a clean rounded degree angle.

SELECT
    employee_id,
    station_code,
    tilt_radians,
    ROUND(DEGREES(tilt_radians), 2) AS tilt_degrees
FROM demo_employees
WHERE station_code IS NOT NULL;
employee_id station_code tilt_radians tilt_degrees
14 BAY-A 0.785398 45.00
15 BAY-B 1.570796 90.00
16 BAY-C -3.141593 -180.00
17 BAY-D NULL NULL

Row 14 converts PI() / 4 radians cleanly into 45.00 degrees, while row 16 converts -PI() into -180.00 degrees. Row 17 has no calibration value yet, so DEGREES() returns NULL.

Common Mistakes & NULL Behavior

  • Passing values already in degrees: Calling DEGREES(90) multiplies 90 by 57.2958, giving 5156.62. Check unit labels before converting.
  • Tiny floating-point leftovers: Because PI() is approximate in IEEE 754 DOUBLE, expressions like DEGREES(ACOS(-0.5)) may yield 120.00000000000001. Apply ROUND(..., 2) when formatting reports.
  • NULL inputs: Passing NULL to DEGREES(NULL) returns NULL.

Frequently Asked Questions

What is the inverse of DEGREES() in MySQL?

Use RADIANS(x) to convert degrees back into radians before calling SIN(), COS(), or TAN().

Does DEGREES() accept negative radians?

Yes. Negative radian angles convert directly to negative degree angles, such as DEGREES(-PI() / 2) returning -90.

What does DEGREES(2 * PI()) return?

It returns 360, representing one full circle rotation in degrees.

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Try it Yourself

Experiment with the code from this lesson in our interactive playground.

Open Playground
MySQL Topic Hub

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum