SCHEMA( )

This MySQL function returns the name of the database currently in use for the session.

Syntax

SCHEMA( )

Explanation

This function returns the name of the database currently in use for the session. There are no arguments. If no database has been set to be the default, it returns NULL.

Examples

SELECT DATABASE( );

+--------------------+
| DATABASE( )        |
+--------------------+
| company_database   |
+--------------------+

Introduced in version 5.0.2 of MySQL, SCHEMA( ) is a synonym for DATABASE( ).