SQL CREATE DATABASE Statement

The CREATE DATABASE statement in SQL is used to create a new, empty database. This is the first step in setting up a place to store your data.



CREATE DATABASE: Definition and Usage

Before you can start creating tables and adding data, you need a database to hold everything. CREATE DATABASE is the command to create this empty container. You'll need appropriate database administrator privileges to use this command. Once you've created a database, you can then proceed to create tables and populate them with your information.

Syntax

Syntax

CREATE DATABASE database_name;
      

Example

Creating a Database

This example creates a database named "testDB". Make sure you have the necessary administrative privileges.

Syntax

CREATE DATABASE testDB;
      
Output

A new, empty database named "testDB" is created. You can confirm this by running a command to list your databases (e.g., SHOW DATABASES; in MySQL, or a similar command for your database system).


**Important Note:** The exact command to list databases varies depending on your database system (MySQL, PostgreSQL, SQL Server, etc.). Always refer to your database system's documentation. You'll typically need administrator-level privileges to create a new database.