COT(X) returns the cotangent of X in radians. Cotangent is undefined where the sine is zero; for example, COT(0) produces an out-of-range error in current MySQL rather than a normal numeric result.
SELECT ROUND(COT(PI() / 2), 2); -- Output: 0.00
SELECT ROUND(COT(PI() / 3), 2); -- Output: 0.58
SELECT COT(1); -- Finite cotangent value
SELECT COT(X);
Use PI() for π and ROUND() when you need fewer decimal places.
SELECT COT(RADIANS(45)); -- Output: 1
SELECT ROUND(COT(RADIANS(90)), 2); -- Output: 0.00
-- Avoid 0°, 180° and other points where cotangent is undefined
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.