MySQL DEGREES function is one of the Numeric Functions, which is useful to convert the radiant values into degrees. The syntax of the DEGREES in MySQL is as shown below:
SELECT DEGREES (Numeric_Expression) FROM Source
To demonstrate this DEGREES Numeric function, we are going to use the below shown data
MySQL DEGREES Function Example 1
The MySQL DEGREES convert the radiant values to degrees. The following query shows multiple ways to use the DEGREES function.
-- MySQL DEGREES Function Example -- Finding Degrees for Negative Value SELECT DEGREES(-10.75) AS `Value in Degrees`; -- Finding Degrees for Positive Value SELECT DEGREES(2.67) AS `Value in Degrees`; -- Degrees Example along with PI() SELECT DEGREES(PI()) AS `Value in Degrees`; SELECT DEGREES(PI()/2) AS `Value in Degrees`; SELECT DEGREES(PI()/3) AS `Value in Degrees`; -- Degree of string value SELECT DEGREES('6.74') AS `Value in Degrees`; -- Degrees Example on String SELECT DEGREES('MySQL') AS `Value in Degrees`;
From the below screenshot, you can see that we used DEGREES function on different values.
and
MySQL DEGREES Example 2
The MySQL DEGREES Numeric also allows you to find the degree values for the column data. In this example, we are going to find the equivalent degree values for all the records present in the Service Grade column.
-- MySQL DEGREES Function Example USE mysqltutorial; SELECT Product, Color, StandardCost, Sales, TaxAmt, ServiceGrade, DEGREES(ServiceGrade) AS `Grade Value in Degrees` FROM `numeric functions`;