How to find the Current Database?

If you've forgotten or are not sure which database is the current one which can happen easily if you're using multiple databases and switching between them several times use the following statement:
SELECT DATABASE();
DATABASE( ) is a function that returns the name of the current database. If there are no active database selected then this function will return NULL.



The STATUS command (and its synonym, \s)  will also display the current database name along with the additional information:








Please let me know if this piece of information was useful. Happy reading..!!

How to find the Current Database? How to find the Current Database? Reviewed by Suntaragali The Smart Techie on January 01, 2013 Rating: 5

No comments: