Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to come out of a database

Status
Not open for further replies.

mysqlfrk

Programmer
Aug 3, 2011
12
Hi
I am new to this forum.Hope I am Welcome.
I want to know what is the mysql query to come out of a database?
Suppose I have database called Test1.Within it I enter. There are 2 tables inside test1.
Now I want to come out of the database test1.
What is the MySQL query for this?
 
I am using the XAMPP Shell command line.
 
yikes

i would try entering the word "exit" but i am just guessing

i can't even spell lunix, never mind using it



r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
No No @r937.
I am not using Linux!! lol
I am using Windows XP OS but I am using XAMPP for Apache,MySQL & PHP.

 
Also 'exit' command is used to come out of the Command line interface and not for what i am asking for.
Pls read my question and try to understand what i am asking before answering.
 
Using the command line if you want to change databases you can use the USE command.

USE databasename

You can't really exit the current database, but rather just change it.

For help on the mysql commands type help at mysql> prompt

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
OK how to change the database?
And if i cant exit a database,then how to know how many & what are the other databases that are there?
I know of the "use database" command and also "show databases" command.
But i am nested inside a current database say TEST!,then how to see the other databases?
 
It doesn't matter. Using the show databases command will work even if you are currently using a database.

And issuing the USE command again while using a database will change the current database.

In the end you don;t even need to issue a use command if you know the database name. Your queries can explicitly state what database you want to use.

SELECT databasename.tablename.fieldname from databasename.tablename;

You can also use alias so you don't have to write it out every time you need to use it.

SELECT k.fieldname from databasename.tablename as k;



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top