Create Database | Create Database Statement in SQL - sql - sql tutorial - learn sql
sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorialDefine Database Statement
Define Database Statement
- The SQL CREATE DATABASE statement is used to create a new SQL database.
- A database is a collection of organized data. A database is not the same as the Relational Database Management System (RDBMS).
- An RDBMS can have one or multiple databases, whereas a database can only belong to one RDBMS.
- On the other hand, a database can contain one or more tables, whereas a table can only belong to a database
How can we create database in SQL
- Open Microsoft SQL Management Studio.
- Connect to the database engine using database administrator credentials.
- Expand the server node.
- Right click Databases and select New Database.
- Enter a database name and click on OK to create the database.
- Create the database. From the MySQL command line, enter the command CREATE DATABASE
- Display a list of your available databases.
- Select your database.
- Create a table.
- Create an entry in the table.
- Create more entries.
- Run a query on your new database.
syntax
CREATE DATABASE "database_name";
- If we want to create a database called " VEHICLES ", we would type in,
CREATE DATABASE VEHICLES;
Example:
- If you want to create a new database
, then the CREATE DATABASE statement would be as shown below −
SQL> CREATE DATABASE testDB;
- Make sure you have the admin privilege before creating any database.
- Once a database is created, you can check it in the list of databases as follows:
SQL> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| AMROOD |
| WIKITECHY |
| mysql |
| orig |
| test |
| testDB |
+--------------------+
7 rows in set (0.00 sec)