SQL CREATE Database

The SQL CREATE DATABASE statement is used to create a new database in a relational database management system (RDBMS). This is the first step in setting up a database environment where tables, views, and other database objects can be created.
Syntax: CREATE DATABASE database_name;

When creating a database, it's essential to choose a unique name that does not conflict with other existing databases. Additionally, the user must have the appropriate privileges to execute this statement.

Code Example


CREATE DATABASE SchoolDB;
                

Output

Database "SchoolDB" created successfully.

The CREATE DATABASE statement helps define the scope of your work within a database. Once created, the new database becomes the container for all your tables, relationships, views, and stored procedures.

Important Notes:
- You can specify additional options such as the character set and collation when creating a database, depending on the RDBMS.
- Once a database is created, it is essential to select it for use with the USE command.