×

MySQL RADIANS() function

In this context, we will learn how we can use the MySQL RADIANS() function with proper syntax and good examples.

Introduction of MySQL RADIANS() function

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 of the MySQL RADIANS() function

The syntax of the MySQL RADIANS() function is given as follows:

RADIANS(Y)

Parameters or arguments used in MySQL RADIANS() function:

Only one parameter is accepted by the RADIANS() function in MySQL, which is given as follows:

Y: This is the degree value which we want to convert to radian.

Returns: It will return equivalent degree values into radians.

Application used for RADIANS() function:

The RADIANS() function can be used in the given below MySQL versions.:

  • MySQL 5.7
  • MySQL 5.6
  • MySQL 5.5
  • MySQL 5.1
  • MySQL 5.0
  • MySQL 4.1
  • MySQL 4.0
  • MySQL 3.23

Examples of MySQL RADIANS() function:

Now we will look into some MySQL RADIANS() function examples and will explore how we can use the RADIANS function in MySQL.

Example 1:

Here, we will derive the Radians Value for 0 degrees using RADIANS Function in MySQL.

SELECT RADIANS(0) AS Radian_Value;

Output:

Radian_Value
0
1 row in set (0.00 sec)

Example 2:

Here, we will derive the Radians Value for 180 degrees using RADIANS Function in MySQL.

SELECT RADIANS(180) AS Radian_Value;

Output:

Radian_Value
3.141592653589793
1 row in set (0.00 sec)

Example 3:

In this example, we will find out the Radians Value for -90 degrees using RADIANS Function in MySQL.

SELECT RADIANS(-90) AS Radian_Value;

Output:

Radian_Value
-1.5707963267948966
1 row in set (0.00 sec)

Example 4:

When we require to convert radian from a degree of column data, then we can take the help of the RADIANS function in MySQL. For better understanding, we have created 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 we will add some data into 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, here is the Polygon Table –

SELECT * FROM Polygon;
ShapeSidesSum_of_Interior_AnglesEach_Angle
Triangle3180.0060.00
Quadrilateral4360.0090.00
Pentagon5540.00108.00
Hexagon6720.00120.00
Heptagon7900.00128.57
Octagon81080.00135.00
Nonagon91260.00140.00
Decagon101440.00144.00

From the above, we can visualize that the sum of all interior angles and every angle of the Polygon is given in degrees form.

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

Output:

ShapeSidesSum_of_Interior_Angles_InRadianEach_Angle_InRadian
Triangle33.1415926535897931.0471975511965976
Quadrilateral46.2831853071795861.5707963267948966
Pentagon59.424777960769381.8849555921538759
Hexagon612.5663706143591722.0943951023931953
Heptagon715.7079632679489662.2439698192891093
Octagon818.849555921538762.356194490192345
Nonagon921.9911485751285522.443460952792061
Decagon1025.1327412287183452.5132741228718345

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

Application of MySQL RADIANS() function:

This function is used to convert the degree values into radians.

Summary:

In the above context, we have learned how to use the RADIANS() function in MySQL to convert the degree values into radians.


Related Topics

MySQL Date and Time function

The date function displays day, year, month, time, and current date. It shows the date and time as per the requirement of the applications. The data either store on the...

8 minutes read.

MySQL Subquery

The subquery is a MySQL query used to manage data operations. Mainly subquery helps to retrieve data with the necessary condition. It creates a nested query with two different queries....

5 minutes read.

MySQL HEX() function

In this context, we will learn how we can use the MySQL HEX() function with proper syntax and good examples. Introduction of MySQL HEX() function For returning an equivalent hexadecimal string value...

3 minutes read.

MySQL ROUND() function

In this context, we will learn how we can use the MySQL ROUND() function with proper syntax and good examples. Introduction of MySQL ROUND() function The ROUND() function in MySQL is used...

3 minutes read.

MySQL Table

Introduction MySQL table is an essential part of the system. MySQL table stores data using index, rows, and columns. It accesses data from the server quickly because of the table—this table...

22 minutes read.

MySQL Join

The relational database system needs to interconnect multiple tables with each other. MySQL is a popular and easy data management system to connect multiple tables. The foreign key is used...

5 minutes read.

MySQL POWER() function

In this context, we will learn how we can use the MySQL POWER() function with proper syntax and good examples. Introduction of MySQL POWER() function The value of a number raised to...

3 minutes read.

MySQL Unique index

It helps to maintain data integrity to enforce the uniqueness of values in one or more columns. We can create more than one UNIQUE index in a single table, which...

3 minutes read.

MySQL View

Introduction MySQL View is a virtual table to create a clone of the base table. The View does not contain its values or data. MySQL View creates to connect more than...

12 minutes read.

MySQL CEIL() function

In this context, we will learn how we can use the MySQL CEIL () function with proper syntax and good examples. Introduction of MySQL CEIL() function Input is taken by the CEIL()...

3 minutes read.

MySQL CROSS JOIN

MySQL CROSS JOIN combines all possibilities of the two or more tables and returns the result that contains every row from all contributing tables. It links several columns from the...

4 minutes read.

MySQL TAN() Function

Basically, the TAN() function in MySQL is used to give back the tangent of a mentioned number.In any kind of right-angle triangle, the tangent of an angle is the length...

2 minutes read.

MySQL RTRIM() function

In this context, we will learn how we can use the MySQL RTRIM() function with proper syntax and good examples. Introduction of MySQL RTRIM() function It is the function in MySQL that...

2 minutes read.

MySQL Control flow function

The control flow function uses values or operands for logical operations. These functions can works on single and multiple conditions. The control flow function is based on the Boolean expression....

3 minutes read.

MySQL Advance function

The advance function operates numerical values, string values, and data types.  The advance function converts, displays, and compares given values as per requirement. Here, you find out database, table, and...

4 minutes read.

MySQL Descending Index

Descending Index It is a type of index that stores key values in descending order. This query improves the performance of an index query. MySQL system displays the index as per...

3 minutes read.

MySQL Truncate() Function

In this context, we will learn how we can use the MYSQL TRUNCATE function to truncate a number to a mentioned number of decimal places. Syntax of MySQL Truncate Function A number...

2 minutes read.

MySQL Operators

MySQL Operators MySQL operator needs advanced operation on the table and its data. This operator works with the "WHERE" clause. MySQL operators are a statement to modify information. It helps to...

13 minutes read.

MySQL variable

The MySQL variable is essential for storing data in the table. The variable declares data with a specific name or label to avoid confusion. This data label is used in...

6 minutes read.

MySQL RADIANS() function

In this context, we will learn how we can use the MySQL RADIANS() function with proper syntax and good examples. Introduction of MySQL RADIANS() function RADIANS() function in MySQL is used to...

2 minutes read.