April 2008
Intermediate to advanced
566 pages
21h 55m
English
DATABASE()
DATABASE()
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 default yet, it returns NULL; prior to version 4.1.1 of MySQL, it returns an empty string. Here is an example:
SELECT DATABASE( ); +--------------------+ | DATABASE( ) | +--------------------+ | company_database | +--------------------+
As of version 5.0.2 of MySQL, SCHEMA() has
been introduced as a synonym for DATABASE().
Read now
Unlock full access