(mysql.info.gz) USE
Info Catalog
(mysql.info.gz) DESCRIBE
(mysql.info.gz) Basic User Commands
13.3.2 `USE' Syntax
-------------------
USE DB_NAME
The `USE DB_NAME' statement tells MySQL to use the DB_NAME database as
the default (current) database for subsequent statements. The database
remains the default until the end of the session or until another `USE'
statement is issued:
mysql> USE db1;
mysql> SELECT COUNT(*) FROM mytable; # selects from db1.mytable
mysql> USE db2;
mysql> SELECT COUNT(*) FROM mytable; # selects from db2.mytable
Making a particular database current by means of the `USE' statement
does not preclude you from accessing tables in other databases. The
following example accesses the `author' table from the `db1' database
and the `editor' table from the `db2' database:
mysql> USE db1;
mysql> SELECT author_name,editor_name FROM author,db2.editor
-> WHERE author.editor_id = db2.editor.editor_id;
The `USE' statement is provided for Sybase compatibility.
Info Catalog
(mysql.info.gz) DESCRIBE
(mysql.info.gz) Basic User Commands
automatically generated byinfo2html