imagine you are the mysql database engine, sitting there on the server, minding your own business, responsible for processing the sql that comes in, and for managing all the databases under your control
now along comes fred and asks, "which one is the current database?"
"Most database servers, including MySQL, can offer access to more than one database. When a user has opened a connection with a database server and wants, for example, to create new tables or query existing tables, he must specify the database he wants to work with. This is called the current database. There can be only one current database. That means that all SQL statements will be fired at this database." --Quoted from section 4.5 of "Introduction to SQL Mastering the Relational Database Language 4th Edition"
use Foo -- This sql make Foo the current database.
So my question is how to display the current database for the user?? Make sense??
I am accessing MySql server using mysql command line client.
For example, when you issue a sql to create a table like "create table foo", the server has to know which database is the target. The default is the current database. And you can change the current database using "use dataBaseName" sql statement. This totally makes sense to me.
Why you guys say there is no such a thing??? I am confused....really