MySQL COT() function

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

Syntax

SELECT COT(X);

Use PI() for π and ROUND() when you need fewer decimal places.

COT() with RADIANS()

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



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