Sie sind auf Seite 1von 2

Teradata SQL Quick Reference Guide: Simplicity by Design, Second

Edition
by Tom Coffing, Michael Larkins and Steve Wilmes
Coffing Data Warehousing. (c) 2006. Copying Prohibited.

Reprinted for Anil Kumar Gupta, IBM


anilkugu@in.ibm.com
Reprinted with permission as a subscription benefit of Books24x7,
http://www.books24x7.com/

All rights reserved. Reproduction and/or distribution in whole or in part in electronic,paper or


other forms without written permission is prohibited.

TeradataSQLQuickReferenceGuide:SimplicitybyDesign,SecondEdition

Appendix D: Mathematical Functions


This is a chart of those Teradata arithmetic, trigonometric and hyperbolic math functions:
Operator

Operation performed

MOD x

Modulo returns the remainder from a division (1 mod 2 derives 1, as the remainder of division, 2 goes into 1, 0 times with a remainder of 1. Then, 2
mod 10 derives 2, 10 goes into 2, 0 times with a remainder of 2). MOD always returns 0 thru x-1. As such, MOD 2 returns 0 for even numbers and 1
for odd; MOD 7 can be used to determine the day of the week; and MOD 10, MOD 100, MOD 1000, etc can be used to shift the decimal of any
number to the left by the number of zeroes in the MOD operator.

ABS(x)

Absolute value, the absolute value of a negative number is the same number as a positive x. (ABS(10-12) = 2)

EXP(x)

Exponentiation, e raised to a power, (EXP(10) derives 2.20264657948067E004)

LOG(x)

Logarithm calculus function, (LOG(10) derives the value 1.0000000000000E000)

LN(x)

Natural logarithm, (LN(10) derives the value 2.30258509299405E000)

SQRT(x)

Square root, ( SQRT(10) derives the value 3.16227766016838E000)

COS(x)

Takes an angle in radians (x) and returns the ratio of two sides of a right triangle. The ratio is the length of the side adjacent to the angle divided by
the length of the hypotenuse. The result lies in the range -1 to 1, inclusive where x is any valid number expression that expresses an angle in
radians.

SIN(x)

Takes an angle in radians (x) and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite to the angle divided by
the length of the hypotenuse. The result lies in the range -1 to 1, inclusive where x is any valid number expression that expresses an angle in
radians.

TAN(x)

Takes an angle in radians (x) and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite to the angle divided by
the length of the side adjacent to the angle where x is any valid number expression that expresses an angle in radians.

ACOS(x)

Returns the arccosine of x. The arccosine is the angle whose cosine is x where x is the cosine of the returned angle. The values of x must be
between -1 and 1, inclusive. The returned angle is in the range 0 to radians, inclusive.

ASIN(x)

Returns the arcsine of (x). The arcsine is the angle whose sine is x where x is the sine of the returned angle. The values of x must be between -1
and 1, inclusive. The returned angle is in the range /2 to /2 radians, inclusive.

ATAN(x)

Returns the arctangent of (x). The arctangent is the angle whose tangent is arg. The returned angle is in the range /2 to /2 radians, inclusive.

ATAN2
(x,y)

Returns the arctangent of the specified (x,y) coordinates. The arctangent is the angle from the x-axis to a line contained the origin(0,0) and a point
with coordinates (x,y).
The returned angle is between and radians, excluding. A positive result represents a counterclockwise angle from the x-axis where a negative
result represents a clockwise angle. The ATAN2(x,y) equals ATAN(y/x), except that x can be 0 in ATAN2(x,y) and x cannot be 0 in ATAN(y/x)
since this will result in a divide by zero error. If both x and y are 0, an error is returned.

COSH(x)

Returns the hyperbolic cosine of (x) where x is any real number.

SINH(x)

Returns the hyperbolic sine of (x) where x is any real number.

TANH(x)

Returns the hyperbolic tangent of (x) where arg is any real number.

ACOSH(x)

Returns the inverse hyperbolic cosine of (x). The inverse hyperbolic cosine is the value whose hyperbolic cosine is a number so that x is any real
number equal to, or greater than, 1.

ASINH(x)

Returns the inverse hyperbolic sine of (x). The inverse hyperbolic sine is the value whose hyperbolic sine is a number so that x is any real number.

ATANH(x)

Returns the inverse hyperbolic tangent of (x). The inverse hyperbolic tangent is the value whose hyperbolic tangent is a number so that x is any real
number between 1 and -1, excluding 1 and -1).

Page 2 / 2
Reprintedforibm\anilkugu@in.ibm.com,IBM

CoffingDataWarehousing,CoffingPublishing(c)2006,CopyingProhibited