×

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

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

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 Command line client Basic Queries

MySQL – command line client Basic Queries There are many queries to work with the MySQL command-line client. Today, we will explore MySQL basic queries and their function. The MySQL query...

8 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 database queries

MySQL database queries Database queries help to create, use, show and, delete the database. A Database is a collection of several tables and data. The database uses SQL language to perform...

3 minutes read.

MySQL Data Types

Introduction of the Data types In the data file, we have several information such as names, numbers, marks, and other information. This information specifies categories such as numbers, characters, and decimal...

8 minutes read.

MySQL FIND_IN_SET() function

In this context, we will learn how we can use the MySQL MOD() function with proper syntax and good examples. Introduction of MySQL MOD() function MySQL provides a built-in string function called...

4 minutes read.

MySQL POW() function

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

2 minutes read.

MySQL NATURAL JOIN

The natural join combines multiple tables using a column with the same name and data type. This operation combines a row of the two tables using common columns. This join...

4 minutes read.

MySQL vs Oracle

What is MySQL? The open-source MySQL relational database management system is a vital software component for web-based applications. As the data is saved and sent over the internet, databases and related...

6 minutes read.

MySQL Invisible Index

Invisible Index MySQL index decides an option to the availability of the index for the query optimizer. This index shows the visible and invisible options to displays the index column in...

3 minutes read.

MySQL NOW() function

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

2 minutes read.

MySQL LENGTH() Function

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

2 minutes read.

MySQL Full text index

Full text index The full-text index in the table isused to search the full text of the data. This index assigns to the table using a "FULLTEXT" keyword. First, the table...

3 minutes read.

MySQL PERIOD_ADD() function

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

2 minutes read.

MySQL ISNULL function

This function is used to check the null value in table data. It returns the result in a Boolean form. If table data is null, then the output becomes 1....

2 minutes read.

MySQL MOD() function

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

3 minutes read.