Back to Developer Roadmap

ABS

src/data/roadmaps/sql/content/abs@6vYFb_D1N_-tLWZftL-Az.md

4.0736 B
Original Source

ABS

The ABS() function in SQL returns the absolute value of a given numeric expression, meaning it converts any negative number to its positive equivalent while leaving positive numbers unchanged. This function is useful when you need to ensure that the result of a calculation or a value stored in a database column is non-negative, such as when calculating distances, differences, or other metrics where only positive values make sense. For example, SELECT ABS(-5) would return 5.

Visit the following resources to learn more: