website logo
⌘K
🏠Homepage
πŸ‘‹Introduction
Key Concepts & Architecture
πŸš€Run Oxla in 2 minutes
πŸƒβ€β™‚οΈRun Oxla on S3
πŸ›«Multi-node Deployment
πŸ‘¨β€πŸ’»SQL Reference
SQL Queries
SQL Clauses
SQL Data Types
SQL Functions
Schema
Comment Support
🚨Error Handling
πŸ†šDifferences Between Oxla vs. PostgreSQL
πŸ“ˆPublic Metrics
Docs powered by
Archbee
SQL Reference
...
SQL Functions
Aggregation Functions

ABS

7min

Overview

The ABS() function returns the absolute value of a number.

The input and return types we support can be seen in the table below.

Document image
ο»Ώ

βœ… The ABS() function returns a value that is the same as the input types.

Examples

#Case 1: Basic Absolute

The following example will calculate the absolute value of a negative floating number:

Select abs
|
SELECT ABS(-22.50) AS "Absolute";
ο»Ώ

It will return the floating number without the negative value:

Output
|
+-----------+
| Absolute  |
+-----------+
| 22.50     |
+-----------+
ο»Ώ

#Case 2: Absolute with an expression

The following example calculates the absolute value of an expression i.e., the subtraction operation:

Select abs
|
SELECT ABS( 150 - 250 ) AS "Absolute";
ο»Ώ

We know that the result of (150 - 250) is -100, but in this case, we’re using an ABS() function to get an absolute number so that the result will ignore the negative value.

Output
|
+-----------+
| Absolute  |
+-----------+
| 100       |
+-----------+
ο»Ώ

ο»Ώ

Updated 31 Aug 2023
Did this page help you?
PREVIOUS
AVG
NEXT
COUNT
Docs powered by
Archbee
TABLE OF CONTENTS
Overview
Examples
#Case 1: Basic Absolute
#Case 2: Absolute with an expression
Docs powered by
Archbee

Dedicated to data analytics that provides 10x faster execution of analytical queries than current state of the art solutions. We are launching SOON! Join the waiting list for more info.




Β©2023 Oxla