Home » RADIANS Function in SQL

RADIANS Function in SQL

by Online Tutorials Library

RADIANS Function in SQL

The RADIANS numeric function of Structured Query Language returns the radians value of the specified degree.

Syntax of RADIANS Function

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

In this first syntax, we have to specify the name of that column on which we want to execute the RADIANS function for converting the degree value into radians.

Syntax2: This syntax uses the RADIANS function with the number:

Examples of RADIANS Function

Example 1: This example returns the Radians value of the specified number (degree):

Output:

Radiansvalue_of_360
6.283

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

Output:

Radiansvalue_of_180
3.14159

Example 3: This example returns the Radians value of 90 degree:

Output:

Radiansvalue_of_90
1.57

Example 4: This example returns the Radians value of -45 degree:

Output:

Radiansvalue_of_-45
-0.785

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

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 RADIANS function with the Vehicle_ID column of the above Vehicle_Details table:

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

Output:

Vehicle_ID Radians value_of_Vehicle_ID
140 2.4436
190 3.316
145 2.531
90 1.571
45 0.785
210 3.665
185 3.229

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

This query shows the Radians value of purchasing vehicles.

Output:

Purchasing_Vehicles Radians value_of_PurchasingVehicles
45 0.785
180 3.14159
270 4.712
360 6.28
45 0.785
160 2.793
450 7.854

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

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

Output:

Vehicle_Rating Radians value_of_vehiclerating
80 1.396
90.85 1.586
80 1.396
180 3.14159
80 1.396
95 1.658
80 1.396

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

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

Output:

Selling_Vehicles Radians value_of_SellingVehicles
80 1.396
180 3.14
290 5.061
80 1.396
-15 -0.2618
-60 -1.0472
470 8.203

You may also like