The CREATE DATABASE keyword in SQL is used to create a new database. Here's the basic syntax:
CREATE DATABASE database_name;
Example:
CREATE DATABASE SchoolDB;
This command will create a new database called SchoolDB.
Optional Parameters:
You can also specify some optional clauses like character set and collation:
CREATE DATABASE database_name
CHARACTER SET charset_name
COLLATE collation_name;
Example with options:
CREATE DATABASE SchoolDB
CHARACTER SET utf8
COLLATE utf8_general_ci;
In this example, the database SchoolDB is created with the character set utf8 and the collation utf8_general_ci.
Note:
- You need appropriate privileges to create a database.
- The
CREATE DATABASEstatement is supported by most SQL database systems like MySQL, PostgreSQL, and SQL Server. However, there may be slight differences in syntax or options depending on the database management system.
No comments:
Post a Comment