Open In App

RADIANS() Function in MySQL

Last Updated : 30 Sep, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

RADIANS() function in MySQL is used to convert the degree values into radians. The formula for converting degree to radian is :

180 degrees = π radian

Syntax :

RADIANS(X)

Parameter : This method accepts only one parameter.
X : The degree value which we convert to radian.
Returns : It returns equivalent degree values into radians.

Example-1 :
Finding Radians Value for 0 degree using RADIANS Function.

SELECT RADIANS(0) AS Radian_Value;

Output :

Radian_Value
0


Example-2 :
Finding Radians Value for 180 degree using RADIANS Function.

SELECT RADIANS(180) AS Radian_Value;

Output :

Radian_Value
3.141592653589793


Example-3 :
Finding Radians Value for -90 degree using RADIANS Function.

SELECT RADIANS(-90) AS Radian_Value;

Output :

Radian_Value
-1.5707963267948966


Example-4 :
Using RADIANS Function to convert radian from a degree for a column data. To demonstrate, let us create a table named Polygon.

CREATE TABLE Polygon (
Shape VARCHAR(100) NOT NULL,
Sides INT NOT NULL,
Sum_of_Interior_Angles DECIMAL(10, 2) NOT NULL,
Each_Angle DECIMAL(10, 2) NOT NULL,
PRIMARY KEY(Sides)
);

Now, insert some data to the Polygon table –

INSERT INTO  
Polygon(Shape, Sides, Sum_of_Interior_Angles, Each_Angle)
VALUES
('Triangle', 3, 180, 60),
('Quadrilateral', 4, 360, 90),
('Pentagon', 5, 540, 108),
('Hexagon', 6, 720, 120),
('Heptagon', 7, 900, 128.57),
('Octagon', 8, 1080, 135),
('Nonagon', 9, 1260, 140),
('Decagon', 10, 1440, 144);

So, the Polygon Table is –

SELECT * FROM Polygon;
Shape Sides Sum_of_Interior_Angles Each_Angle
Triangle 3 180.00 60.00
Quadrilateral 4 360.00 90.00
Pentagon 5 540.00 108.00
Hexagon 6 720.00 120.00
Heptagon 7 900.00 128.57
Octagon 8 1080.00 135.00
Nonagon 9 1260.00 140.00
Decagon 10 1440.00 144.00

We can see that sum of interior angles and each angle of the polygon are given in degrees. Now we will convert these into radians with the help of RADIAN Function.

SELECT Shape, Sides, 
RADIANS(Sum_of_Interior_Angles) AS Sum_of_Interior_Angles_InRadian, 
RADIANS(Each_Angle) AS Each_Angle_InRadian
FROM Polygon;

Output :

Shape Sides Sum_of_Interior_Angles_InRadian Each_Angle_InRadian
Triangle 3 3.141592653589793 1.0471975511965976
Quadrilateral 4 6.283185307179586 1.5707963267948966
Pentagon 5 9.42477796076938 1.8849555921538759
Hexagon 6 12.566370614359172 2.0943951023931953
Heptagon 7 15.707963267948966 2.2439698192891093
Octagon 8 18.84955592153876 2.356194490192345
Nonagon 9 21.991148575128552 2.443460952792061
Decagon 10 25.132741228718345 2.5132741228718345

So, here the sum of an interior angle, and each angle are converted to equivalent radian value.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads