SQL CREATE Database

This statement is used to create a new database in the SQL.

Syntax:

CREATE database "DatabaseName";

DatabaseName – It can be anything i.e. combination of alphanumericals, alphabets, undrscore, hypens etc.

Note : Use semi-colon(;) at the end of line.

Example: below query will create a new database with the name “tutorialmines”.

CREATE database tutorialmines;

Note : Your user should have admin privileges to run this command.

To Check for your database in sql,  use the below command :

SHOW Databases;

It will list all the databases in your sql.

+———————————–+
| Database |
+———————————–+
| information_schema |
| cdcol |
| contact_all |
| dreammarine_live |
| mysql |
| performance_schema |
| phpmyadmin |
| tutorialmines |
| webauth |
+———————————–+
9 rows in set (0.00 sec)

Why there is a need for new Database ?

  • Whenever you get any new project, then creating a new database is your first step.
  • You should give it a logical name rather than any thing. This will help you in memorizing which database is used for which project, Hence
    1. It saves time, in searching files for the name of database used in your project.
    2. Your programming standards are maintained.
    3. Build good programming habits etc.

Now lets move to next step of  How to Use/Select the database.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *