• Last Updated : 30 Sep, 2020

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

Syntax :

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 :

Output :

0

Example-2 :

Output :

3.141592653589793

Example-3 :

Output :

-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),
('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;
ShapeSidesSum_of_Interior_AnglesEach_Angle
Triangle3180.0060.00
Pentagon5540.00108.00
Hexagon6720.00120.00
Heptagon7900.00128.57
Octagon81080.00135.00
Nonagon91260.00140.00
Decagon101440.00144.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,
FROM Polygon;

Output :

Triangle33.1415926535897931.0471975511965976