ACOS(X) returns the arc cosine of X in radians. The input must be between -1 and 1; values outside that range return NULL.
SELECT ACOS(0); -- Output: 1.5707963267948966
SELECT ACOS(1); -- Output: 0
SELECT ACOS(-2); -- Output: NULL
SELECT ROUND(ACOS(0), 2); -- Output: 1.57
SELECT ACOS(X);
The result is the angle whose cosine is X. Use DEGREES() when you want degrees instead of radians.
SELECT DEGREES(ACOS(0)); -- Output: 90
SELECT DEGREES(ACOS(1)); -- Output: 0
SELECT DEGREES(ACOS(-1)); -- Output: 180
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.