# MySQL COS Function

MySQL COS function is one of the Numeric Functions, which calculates the trigonometry cosine of the specified expression. The mathematical formula for this Cosine function is COS(x) = Length of the Adjacent Side / Length of the Hypotenuse. The basic syntax of the COS in MySQL is as shown below:

```SELECT COS (Numeric_Expression)
FROM Source```

To demonstrate this COS Numeric function, we are going to use the below shown data

## MySQL COS Function Example 1

The MySQL COS returns the trigonometric cosine value of any numeric value. The following query shows multiple ways to use the COS function.

```-- MySQL COS Function Example

-- Cosine of Negative Value
SELECT COS(-10.57) AS `Cosine Value`;

-- Cosine of Positive Value
SELECT COS(7.96) AS `Cosine Value`;

-- Cosine of Numeric Expression
SELECT COS(1.75 + 2.25 - 4.00) AS `Cosine Value`;

-- Cosine of string value
SELECT COS('3.14') AS `Cosine Value`;

-- Cosine of String
SELECT COS('MySQL') AS `Cosine Value`;```

From the screenshot below, you can observe that we used MySQL COS function to find the Cosine values of different values. Here, we assigned a new name to the MySQL result as ‘Cosine Value’ using ALIAS Column.

## MySQL COS Example 2

The MySQL COS Numeric also allows you to find the cosine values for the data in table columns. In this example, we are going to find the cosine for all the records present in the Tax Amount column, and Service Grade column.

```-- MySQL Cosine Function Example
USE mysqltutorial;
SELECT Product, Color,
StandardCost, Sales, TaxAmt,
COS(TaxAmt) AS `Tax Cosine Value`, 