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 Functions

Overview

MySQL Functions can be invoked within expressions and returns a value that is used in place of the function call when the expression is evaluated.

Syntax

The general the syntax for a MySQL Function call includes the function name followed by parenthesis
optional argument:

function_name(<arg1>[, <arg2>,…,<argn>])

Spaces around function arguments are permitted. However, by default there must be no white-space between a function name and the parenthesis following it. This helps the MySQL Parser distinguish between function calls and references to tables or columns that happen to have the same name as a function.

Functions in MySQL Expressions

A function call is a value expression, and can thus appear anywhere where a value expression is accepted. Columns are also perfectly fine to use as arguments as long as they are in the correct data type. A function’s output can also be the input to another MySQL function.

An expression that contains NULL always produces a NULL value unless otherwise indicated in the documentation for a particular function or operator. Mathematical functions will return NULL on error ( for example; division by zero)

mysql> SELECT 1/0;
+——+
| 1/0 |
+——+
| NULL |
+——+
1 row in set (0.00 sec)

Examples

The following are examples of simple functions within a SELECT statement:

NOW()

The NOW function returns the current date/time.

VERSION()

The VERSION function returns the MySQL version currently being used on the database server host.

 

MySQL Functions Example

Numeric Functions

https://www.testingdocs.com/mysql-mathematical-functions/

String Functions

https://www.testingdocs.com/mysql-string-functions/

Temporal Functions

https://www.testingdocs.com/mysql-temporal-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 MODIFY COLUMN clause› MySQL ADD INDEX Statement

Recent Posts

  • MS Access Data Types
  • 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

Go to mobile version