Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

DATABASE

Example

Retrieve the name of the currently selected (default) database.

SELECT DATABASE();

Definition and Usage

The DATABASE() function retrieves the name of the current database.

If no database is currently selected, the function returns NULL or an empty string.

Syntax

DATABASE()

Technical Details

Works in:

 From MySQL version 4.0