×

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 Aggregate function

The aggregation function works on the multiple values and returns single value output.  It makes the advanced and complex operation simple. The summation (SUM), MAX, AVG, MIN, COUNT functions are...

5 minutes read.

MySQL CEILING() function

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

2 minutes read.

MySQL Create index

An index creation helps to make a row of the table unique. The index operates and handles table data quickly. MySQL index requires NOT NULL column constraint. The index column...

2 minutes read.

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 FORMAT() function

In this context, we will learn how we can use the MySQL FORMAT() function with proper syntax and good examples. Introduction of MySQL FORMAT() function This function in MySQL helps to format...

2 minutes read.

MySQL Show index

This query helps to access and retrieve table information. This syntax displays the required index or all indexes of the table. It also displays the index type as per the...

3 minutes read.

MySQL Features

Features of MySQL MySQL is a relational database management system (RDBMS): It is a collection of many programs and makes relations with many other programs. Easy to use MySQL database: MySQL...

2 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 Queries

MySQL Queries MySQL supports SQL queries in the MySQL interface. These queries help to interact data with the application. MySQL uses create database, user database, create a table, truncate table, and...

13 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 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 COALESCE function

This statement displays the first non-null value of the table data. The COALESCE function returns a null value when all values of the table are null or do not find...

3 minutes read.

MySQL RIGHT() Function

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

3 minutes read.

MySQL DAY() function

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

2 minutes read.

MySQL DATE_ADD() function

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

3 minutes read.

MySQL Triggers

MySQL trigger is a function of the stored procedure to respond to the system program. This function responds and runs any data table event automatically. You can use it for...

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.

Clustered vs Non-Clustered Index

Clustered vs. Non-Clustered Index The difference between clustered and non-clustered index is the most famous question in the database-related interviews. Both indexes have the same physical structure and are stored as...

2 minutes read.

MySQL Math Function

The math function operates numerical values and displays required number data. The math function finds out sin, cos, tan values. Here, you find out the absolute value, reminder, and logarithmic...

6 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.