<<<<<<< HEAD sin | H2 | SQLDoc
Skip to main content

sin

1. SIN Function

======= sin | H2 Function | SQLDoc

sin

1. SIN Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The SIN function in H2 database is used to calculate the sine of a given angle in radians.

2. Syntax

The syntax for the SIN function in H2 database is as follows:

SIN(angle)

Arguments

  • angle: The angle for which the sine needs to be calculated. It should be a numeric value representing the angle in radians.

Return

  • The SIN function returns the sine of the given angle.

3. Notes

  • The SIN function in H2 database expects the angle to be in radians. If the angle is in degrees, you can convert it to radians using the RADIANS function.
  • If the input angle is not a number or exceeds the numeric range, the SIN function will return NULL.
  • Make sure to use the proper syntax and datatype while using the SIN function to avoid errors.

4. Examples

Here are a few examples demonstrating the usage of the SIN function in H2 database:

Example 1 - Calculating the sine of 0.5 radians:

SELECT SIN(0.5) AS sine;

Output:

sine
-----
0.479425538604203

Example 2 - Calculating the sine of angles stored in a column:

CREATE TABLE angles (
id INT PRIMARY KEY,
angle DOUBLE
);

INSERT INTO angles VALUES (1, 0.5), (2, 1), (3, 1.5);

SELECT id, angle, SIN(angle) AS sine
FROM angles;

Output:

id | angle |       sine
---+-------+-----------------
1 | 0.5 | 0.479425538604203
2 | 1 | 0.8414709848078965
3 | 1.5 | 0.9974949866040544
  • cos - Calculate cosine
  • tan - Calculate tangent