SQL CREATE
Database:
The SQL CREATE DATABASE statement is used by a
developer to create a database.
Let's see the syntax of SQL CREATE DATABASE:
CREATE DATABASE database_name;
If you want to add tables in that database, you can use
CREATE TABLE statement.
Once a database is created, you can check it in the list
of databases as follows:
SQL> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| AMROOD |
| TUTORIALSPOINT |
| mysql |
| orig |
| test |
| testDB |
SQL DROP
Database:
SQL DROP statement is used to
delete or remove indexes from a table in the database.
If you want to delete or drop an existing database in a
SQL schema, you can use SQL DROP DATABASE
Let's see the syntax of SQL DROP DATABASE:
DROP DATABASE database_name;
SQL RENAME
Database:
SQL RENAME DATABASE is used when you need to change the
name of your database. Sometimes it is used because you think that the original
name is not more relevant to the database or you want to give a temporary name
to that database.
To rename the mysql database, you need to follow the
following syntax:
RENAME DATABASE old_db_name TO new_db_name;
SQL SELECT
Database:
In MySQL database, you need to select a database first
before executing any query on table, view etc. To do so, we use following
query:
USE DATABASE database_name;
In oracle, you don't need to select database.
No comments:
Post a Comment