©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The ABS SQL Function in MySQL and MariaDB - Absolute positive value

ABSSyntax:ABS(Number)
Return value:FLOAT, INTEGER
Function type:Numeric function
Function Description

The ABS() SQL function returns the absolute, positive value of "Number".

If "Number" is not numeric, an attempt is made to cast the value to a numeric type before calculating the absolute value.

ABS() returns NULL if the value of "Number" is NULL.

The ABS() function returns 0 if "Number" is not a numeric value.

SQL Examples for the ABS function

 1
 2
 3
 4
 5
 6
 7

SELECT abs(-45.9);
SELECT abs(-45);
SELECT abs('14');
select abs('Test14');
SELECT abs(null);

abs(-45.9)
decimal(5)
45.9
abs(-45)
int(3)
45
abs('14')
double(23)
14
abs('Test14')
double(23)
0
abs(null)
double(17)
NULL
The examples were created with the MyWAY SQL manager: Download

How to use the ABS() function in MySQL and MariaDB databases

The ABS() function in MySQL and MariaDB is used when working with the magnitude of a number and ignoring its sign. This can be useful, for example, when calculating differences between values, calculating distances or getting positive values ​​for further calculations.
ABSACOSADDDATEADDTIMEAES_DECRYPTAES_ENCRYPTANY_VALUE

Further MySQL und MariaDB SQL Numeric functions

BIT_COUNTBIT_COUNT(Integer)
More about BIT_COUNT Function

CEILCEIL(Number)
More about CEIL Function

CEILINGCEILING(Number)
More about CEILING Function

CRC32CRC32(String)
More about CRC32 Function

CRC32CCRC32C([Parameter], String)

FLOORFLOOR(Number)
More about FLOOR Function

SIGNSIGN(Number)
More about SIGN Function

ACOSACOS(Number)
More about ACOS Function

ASINASIN(Number)
More about ASIN Function

ATANATAN(Number [, Number2])
More about ATAN Function

ATAN2ATAN2(Number [, Number2])
More about ATAN2 Function

COSCOS(Number)
More about COS Function

COTCOT(Number)
More about COT Function

DEGREESDEGREES(Number)
More about DEGREES Function

EXPEXP(Number)
More about EXP Function

LNLN(Number)
More about LN Function

LOGLOG([Base], Number)
More about LOG Function

LOG10LOG10(Number)
More about LOG10 Function

LOG2LOG2(Number)
More about LOG2 Function

MODMOD(Number, Divider)
More about MOD Function

POWPOW(Number, Exponent)
More about POW Function

POWERPOWER(Number, Exponent)
More about POWER Function

PIPI()
More about PI Function

RADIANSRADIANS(Number)
More about RADIANS Function

RANDRAND([Number])
More about RAND Function

ROUNDROUND(Number [, Decimals])
More about ROUND Function

SINSIN(Number)
More about SIN Function

SQRTSQRT(Number)
More about SQRT Function

TANTAN(Number)
More about TAN Function

TRUNCATETRUNCATE(Number, Decimals)
More about TRUNCATE Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the ABS SQL function: mysql.com and mariadb.com and w3schools.com
Updated: 2023-09-24ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer