TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

MySQL

MySQL Numeric Functions

Overview

In this tutorial, we will learn about MySQL Numeric functions with examples. Numeric are mathematical functions that perform several types of operations such as rounding, truncation, generating random numbers, trigonometric calculations, etc.

MySQL Numeric Functions

Some functions are listed below:

Numeric Function
Description
ABS(<number>)

 

Returns the absolute value of number
SIGN(<number>) Returns-1,0 or depending on whether number is negative, zero or positive
TRUNCATE(<number>, <decimals>) Returns number truncated to decimals
FLOOR(<number>) Rounds number down to the closest lower integer
CEILING (<number>) Rounds number up to the closest higher integer
ROUND(<number>) Rounds number to the closest integer.Rounds up on DECIMAL data types
It will round away from zero for >=0.5, to zero on < 0.5

 

Examples

mysql> SELECT ABS(-35), ABS(35) ;
+———-+———+
| ABS(-35) | ABS(35) |
+———-+———+
| 35 | 35 |
+———-+———+
1 row in set (0.00 sec)

mysql> SELECT SIGN(-1), SIGN(0), SIGN(1);
+———-+———+———+
| SIGN(-1) | SIGN(0) | SIGN(1) |
+———-+———+———+
| -1 | 0 | 1 |
+———-+———+———+
1 row in set (0.01 sec)

MySQL Numeric Functions

—

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Related Posts

DataGrip Desktop Shortcut

MySQL /

Launch DataGrip on Windows

DataGrip Download

MySQL /

Install DataGrip IDE on Windows 11

MySQL Workbench Windows 11

MySQL /

New MySQL Connection in Workbench

MySQL Command-line Client

MySQL /

Command-Line MySQL Client

Start MySQL Client

MySQL /

Start MySQL Client on Windows 11

‹ MySQL Temporal Functions› MySQL TRIM Function

Recent Posts

  • Update draw.io on Windows
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com