ABS() Examples in SQL Server

In SQL Server, the ABS() function returns the absolute value of a specified value.

You provide the value as an argument. The return value is of the same type as the argument.

An absolute value is the distance of a number on the number line from 0 without considering which direction from zero the number lies. Therefore, the absolute value of a number is always a non-negative value (i.e. it’s never negative).

Continue reading

MySQL SIN() Function – Return the Sine of a Number in MySQL

In MySQL, the SIN() function returns the sine of a given value, where the value is given in radians.

The sine is a trigonometric function of an angle. The sine of an acute angle is defined in the context of a right triangle: for the specified angle, it is the ratio of the length of the side that is opposite that angle to the length of the longest side of the triangle (the hypotenuse).

Continue reading

MySQL SIGN() Function – Find Out Whether a Number is Positive or Negative in MySQL

In MySQL, the SIGN() function returns the sign of a number. That is, it indicates whether or not the value is a positive number, a negative number, or zero.

You provide the value as an argument when calling the function.

The function returns the following result, depending on whether the argument is positive, negative, or zero.

  • 1 if the number is positive
  • -1 if the number is negative
  • 0 if the number is zero

Continue reading