totn MariaDB Functions

MariaDB: DATABASE Function

This MariaDB tutorial explains how to use the MariaDB DATABASE function with syntax and examples.

Description

The MariaDB DATABASE function returns the name of the default database.

Syntax

The syntax for the DATABASE function in MariaDB is:

DATABASE( )

Parameters or Arguments

There are no parameters or arguments for the DATABASE function in MariaDB.

Note

  • The DATABASE function uses the utf8 character set.
  • The DATABASE function will return NULL, if there is no default database.

Applies To

The DATABASE function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB DATABASE function examples and explore how to use the DATABASE function in MariaDB.

For example:

SELECT DATABASE();
Result: 'test'

This DATABASE function example would return the name of the default database. So if our default database was called test, this example would return the string 'test'.