# DEGREES Function in SQL

The DEGREES is a mathematical function in the Structured Query Language which converts the specified value of radians into degree.

This function accepts the angle of radian as argument and returns the equivalent angle in degree. The return type of function is same as the argument type.

### Syntax of DEGREES Function

Syntax1: This syntax uses the DEGREES function with the column name of the SQL table:

In this SELECT syntax, we have to specify the name of that numeric column on which we want to use DEGREES function.

Syntax2: We can also use the DEGREES function with the particular number as shown in the following block:

### Examples of DEGREES Function

Example 1: This example returns the Degree value of the specified number:

Output:

Degreevalue_of_360
20626.5

Example 2: This example returns the Degree value of the specified number:

Output:

Degreevalue_of_180
10313.2

Example 3: This example returns the Degree value of 90 radians:

Output:

Degreevalue_of_90
5156.62

Example 4: This example returns the Degree value of -45 radian:

Output:

Degreevalue_of_-45
-2578.31

Example 5: This example returns the Degree value of the given expression:

Output:

Degreevalue_of_Expression
3437.75

Example 6: This example uses the DEGREES function with the SQL table.

In this example, we will create the new table through which we will perform the DEGREES function on the columns:

The following shows the syntax to create the new table in SQL:

The following CREATE statement creates the Vehicle_Details table for storing the details of purchasing and selling vehicles:

The following multiple INSERT queries insert the records of vehicles with their quantity, and number of selling and purchasing vehicles into the Vehicle_Details table:

The following SELECT statement displays the inserted records of the above Vehicle_Details table:

Vehicle_ID Vehicle_Name Vehicle_Quantity Purchasing_Vehicles Selling_Vehicles Release_Date Vehicle_Rating
140 P1 290 45 80 2022-04-30 80
190 P4 15 180 180 2022-01-28 90.85
145 P2 20 270 290 2022-02-18 80
90 P7 10 360 80 2021-12-25 180
45 P6 35 45 -15 2021-10-15 80
210 P8 30 160 -60 2022-01-28 95
185 P10 290 450 470 2022-04-11 80

Query 1: The following SELECT query uses the DEGREES function with the Vehicle_ID column of the above Vehicle_Details table:

This query shows the Degree value of vehicle id of each vehicle.

Output:

Vehicle_ID Degree value_of_Vehicle_ID
140 8021.41
190 10886.2
145 8307.89
90 5156.62
45 2578.31
210 12032.1
185 10599.7

Query 2: The following SELECT query uses the DEGREES function with the Purchasing_Vehicles column of the above Vehicle_Details table:

This query shows the Degree value of purchasing vehicles.

Output:

45 2578.31
180 10313.2
270 15469.9
360 20626.5
45 2578.31
160 9167.32
450 25783.1

Query 3: The following SELECT query uses the DEGREES function with the Vehicle_Rating column of the above Vehicle_Details table:

This query shows the Degree value of rating of each vehicle from the above table.

Output:

Vehicle_Rating Degree value_of_vehiclerating
80 4583.66
90.85 5205.321
80 4583.66
180 10313.2
80 4583.66
95 5443.1
80 4583.66

Query 4: The following SELECT query uses the DEGREES function with the and Purchasing_Vehicles and Selling_Vehicles column of the above Vehicle_Details table:

This query shows the Degree value of selling Vehicles of each vehicle.

Output:

Selling_Vehicles Degree value_of_SellingVehicles
80 4583.66
180 10313.2
290 16615.8
80 4583.66
-15 -859.437
-60 -3437.75
470 26929