Cos Function In Sql in SQL
? COS Function in SQL
The COS() function returns the cosine of a given angle (in radians).
? Syntax
COS(angle_in_radians)angle_in_radians: The angle value in radians (not degrees).
? Example Usage
SELECT COS(0); -- Result: 1SELECT COS(PI()/2); -- Result: close to 0SELECT COS(PI()); -- Result: -1? Notes
If you have an angle in degrees, convert it to radians first:
SELECT COS(RADIANS(60)); -- cosine of 60 degreesAvailable in most SQL databases like MySQL, PostgreSQL, SQL Server, Oracle.
If you want, I can show examples converting degrees to radians or usage in specific SQL dialects!