Skip to main content

degrees

1. DEGREES Function

The DEGREES function in H2 database is used to convert an angle from radians to degrees.

2. Syntax

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

DEGREES(angle)

Arguments

  • angle: The angle to be converted from radians to degrees. It should be a numeric value representing the angle in radians.

Return

  • The DEGREES function returns the angle converted from radians to degrees.

3. Notes

  • The DEGREES function in H2 database expects the input angle to be in radians. If the angle is already in degrees, using DEGREES function will have no effect.
  • If the input angle is not a number or exceeds the numeric range, the DEGREES function will return NULL.
  • It is important to ensure the correct syntax and data type while using the DEGREES function to avoid errors.

4. Examples

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

Example 1 - Converting an angle from radians to degrees:

SELECT DEGREES(1.5708) AS angle_degrees;

Output:

angle_degrees
-------------
90.0000

Example 2 - Converting angles stored in a column from radians to degrees:

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

INSERT INTO angles VALUES (1, 0.7854), (2, 1.5708), (3, 2.3562);

SELECT id, angle_radians, DEGREES(angle_radians) AS angle_degrees
FROM angles;

Output:

id | angle_radians | angle_degrees
---+---------------+--------------
1 | 0.7854 | 45.0000
2 | 1.5708 | 90.0000
3 | 2.3562 | 135.0000
  • radians - Convert an angle from degrees to radians
  • sin - Calculate sine
  • cos - Calculate cosine