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

  1. Angle in degrees, e.g. 30
  2. Already in radians? Yes: Pass it straight to SIN. No: RADIANS(30) = 0.5236.
  3. Compute the sine
  4. Return a value between -1 and 1 (0.5)

Syntax

SIN(radians)

Example

SELECT SIN(0);
-- 0

Key points

SQL topics

Introduction to SQL

Querying Data

Sorting Rows

Limiting Rows

Filtering Rows

Joining Multiple Tables

Grouping Rows

SET Operators

Working with Tables

Modifying Data

Views & Triggers

Conditional Expressions

SQL Subqueries

Aggregate Functions

Window Functions

String Functions

Date Functions

Math Functions

Extra Concepts

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Master SQL from Zero to Pro

All SQL topics in one place. Click any topic in the sidebar — content opens right here without leaving the page.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice SQL Online Solve 150 SQL interview problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

SQL  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
▶ Try It Live — runs against a real sample database
{{ liveError }}
{{ col }}
{{ cell }}
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic