SIN()
SQL · Math Functions
Theory
SIN returns the trigonometric sine of an angle. In a right-angled triangle, sine is the opposite side divided by the longest side (the hypotenuse), so it always lies between -1 and 1. SIN(0) is 0, the sine of 30 degrees is 0.5 and the sine of 90 degrees is 1.
The important rule in SQL is that SIN expects radians, not degrees. A full circle is 360 degrees or 2π radians, so 30 degrees is π/6 ≈ 0.5236 radians. Most databases provide RADIANS() and DEGREES() to convert, plus PI(); you can also multiply by PI() / 180 yourself. Writing SIN(30) is a common bug: it treats 30 as radians and returns about -0.988. SIN is rarely used in business reporting, but it appears in geospatial distance formulas (haversine), in modelling repeating seasonal patterns and in physics or engineering data. It is available in PostgreSQL, MySQL, SQL Server, Oracle, Snowflake and SQLite builds with math functions.
Why we use it
Some calculations involve angles: distances on a globe, directions, and cycles like hour-of-day or seasons. SIN converts an angle into a value between -1 and 1 that those formulas need.
When to use it
Use SIN inside geospatial or cyclical formulas, always after converting degrees with RADIANS(). For everyday distances on a map, prefer the database's geospatial functions if it has them.
How it works
- Angle in degrees, e.g. 30
- Already in radians? Yes: Pass it straight to SIN. No: RADIANS(30) = 0.5236.
- Compute the sine
- Return a value between -1 and 1 (0.5)
Syntax
SIN(radians)Example
SELECT SIN(0);
-- 0Key points
- Input is in radians, not degrees
- Rarely used outside of scientific/geospatial calculations
- Convert with RADIANS(deg) or deg * PI() / 180
- Output is always between -1 and 1
- SIN(30) is not 0.5 — it treats 30 as radians