Skip to content

Commit 2dcec6e

Browse files
authored
Degrees entry is completed and revised (#7549)
* Degrees entry is written and revised * minor tweaks - added headings like parameters and return value * format fix ---------
1 parent c4f9cb7 commit 2dcec6e

File tree

1 file changed

+63
-0
lines changed
  • content/sql/concepts/math-functions/terms/degrees

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
Title: 'DEGREES()'
3+
Description: 'Converts an angle from radians to degrees.'
4+
Subjects:
5+
- 'Computer Science'
6+
- 'Data Science'
7+
- 'Data Visualization'
8+
Tags:
9+
- 'Functions'
10+
- 'MySQL'
11+
- 'PostgreSQL'
12+
- 'SQLite'
13+
- 'SQL'
14+
CatalogContent:
15+
- 'learn-sql'
16+
- 'paths/analyze-data-with-sql'
17+
---
18+
19+
The **`DEGREES()`** function in SQL is a mathematical function used to convert a value expressed in radians to its equivalent in degrees. This function is available in various SQL dialects, including SQL Server, MySQL, and Oracle.
20+
21+
> **Note:** Functions `RADIANS()` and `PI()` are closely related to `DEGREES()`.
22+
23+
## Syntax
24+
25+
```pseudo
26+
DEGREES(number)
27+
```
28+
29+
**Parameters:**
30+
31+
- `number`: A numeric expression in radians to be converted to degrees.
32+
33+
**Return value:**
34+
35+
Returns the angle in degrees as a numeric value.
36+
37+
## Example 1
38+
39+
This example converts a specific radian value to degrees:
40+
41+
```sql
42+
Select DEGREES(1.0) as degrees_value;
43+
```
44+
45+
The output:
46+
47+
| <center>degrees_value</center> |
48+
| ---------------------------------- |
49+
| <center>57.29577951308232</center> |
50+
51+
## Example 2
52+
53+
This query converts PI\*2 radians to degrees:
54+
55+
```sql
56+
SELECT DEGREES(PI()*2) as degrees_off_of_pi;
57+
```
58+
59+
The output:
60+
61+
| <center>degrees_off_of_pi</center> |
62+
| ---------------------------------- |
63+
| <center>360</center> |

0 commit comments

Comments
 (0)