The CREATE DATABASE
statement in SQL is used to create a new database within a database management system (DBMS). It typically includes the name of the new database being created.
Here's a basic example of how to use the CREATE DATABASE
statement:
CREATE DATABASE YourDatabaseName;
This statement will create a new database with the name "YourDatabaseName".
Depending on the database management system you are using, there may be additional options you can include in the statement. For example, in MySQL, you can specify the character set and collation for the new database:
CREATE DATABASE YourDatabaseName CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
In SQL Server, you can also specify options like file location and growth parameters:
CREATE DATABASE YourDatabaseName ON PRIMARY (NAME = YourDatabaseName_Data, FILENAME = 'C:\Path\To\YourDatabaseName.mdf', SIZE = 100MB, MAXSIZE = UNLIMITED, FILEGROWTH = 10MB);
These additional options provide more control over the characteristics and behavior of the new database. However, the basic syntax remains the same across different database management systems: CREATE DATABASE
followed by the name of the new database.