Showing posts with label database commands in mysql. Show all posts
Showing posts with label database commands in mysql. Show all posts

Friday, March 30, 2012

Creating & Managing Databases in MySql

DATABASE:

A database is a collection of tables. It stores various tables and used for managing these tables.

DATABASE COMMANDS

1. CREATE DATABASE: used for creating new database.

Syntax: CREATE DATABASE database_name;
Example: CREATE DATABASE dbase;

Note:- After creating the database you have to set your database as current database, so all work done by you will affect the current database.

We can set a database as current database by using use command.

2. USE DATABASE: To set the database as current database.

Syntax: USE database_name;

Example: USE dbase;
Note:- now all your work will be stored in dbase database

3. Delete database:- The DROP DATABASE command is used to delete a database.

Syntax:
DROP DATABASE database_name;
Example: DROP DATABASE dbase;

***********************************************************************************************

To view all databases type the following command after entering password in the mysql command prompt:-

SHOW DATABASES;