Tutorial Gateway

  • C Language
  • Java
  • R
  • SQL
  • MySQL
  • Python
  • BI Tools
    • Informatica
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • QlikView
  • Js

SQL COT Function

by suresh

The SQL COT Function is a SQL Mathematical Function that calculates the trigonometry Cotangent for the specified expression. The syntax of the SQL Server COT Function is

SELECT COT (Float_Expression)
FROM [Source]

For this COT Function demo, we use the below-shown data

SQL COT FUNCTION

SQL COT Function Example 1

The mathematical formula for this function is COT(x) = 1 / TAN(x). The COT Function calculates the Cotangent value for the given angle. The following query shows you multiple ways to use the COT function.

TIP: Please refer SQL TAN Function article.

DECLARE @i float
SET @i = 208.45

SELECT COT(@i)AS [SQL Cotangent]

-- Calculating COT directly
SELECT COT(0.24)AS [SQL Cotangent]

-- Calculating COT directly
SELECT COT(10.232)AS [SQL Cotangent]

-- Calculating COT directly
SELECT COT(1)AS [SQL Cotangent]

OUTPUT

SQL COT FUNCTION 1

ANALYSIS

We used the COT function to calculate the Cotangent value for the variable @i. It means COT(208.45) and assigned the name ‘Cotangent’ using ALIAS.

SELECT COT(@i)AS [SQL Cotangent]

COT Function Example 2

We are going to calculate the Cotangent value for all the records present in [Tax Amount] and [Service Grade] using COT Function.

SELECT [EnglishProductName]
      ,[SalesAmount]
      ,[TaxAmt]
      ,COT([TaxAmt]) AS [Tax Cotangent]
      ,[Service Grade] AS Grade
      ,COT ([Service Grade]) AS [COT Function] 
  FROM [Mathemetical Functions]

OUTPUT

SQL COT FUNCTION 2

Placed Under: SQL

Trending Posts

MySQL LOCALTIMESTAMP

MySQL LIMIT

Table Variable in SQL Server

JavaScript MAX

C Program to Delete an Element in an Array

Publish App in Power BI

Select First Row in each SQL Group By group

JavaScript setUTCFullYear

SQL @@SPID

SQL PARSE Function

  • C Programs
  • Java Programs
  • SQL FAQ’s
  • Python Programs
  • SSIS
  • Tableau
  • JavaScript

Copyright © 2019 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy