H I O X INDIA
MySQL Tutorial
Google
Web hscripts.com
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Mysql Tutorial
Introduction
How to Install
Database
Datatypes
Tables
INSERT
SELECT
UPDATE
DELETE
Operators
Functions
Ask Your Doubts
Feedback





Selecting a database


Topic

Selecting or using a Database.
How to Select a database in MySQL?



Explanation

    If you want to create tables for a database first you have to select the database. For selecting a database you have to enter the following query :
mysql> USE sample;
Database changed
    Here sample is the database you want to select. The USE command dosen't need a semicolon at the end of the query.

    You can use the following command to view the current database that you're connected to:

mysql> select database();
+------------+
| database() |
+------------+
|  sample    |
+------------+
    Understand the difference between Use database and select database() as the former is selecting a database and the later one is displaying the currently selected one. After selecting the database you can create tables and other such operations.

Note : You have to select the database using the USE statement everytime you are entering into Mysql server or when you want to change the database.

     If you type the following query you can see an information like Empty set (ie.,) there are no tables in the selected database.

mysql> show tables;
Empty set (0.00 sec)




others


        MySQL is the most popular open source database Management system. Being a open source anyone can use and change the software for their needs. Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this MySQL tutorial. This is a copyright content.


privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Other Links