SQL statement to create a MySQL database: CREATE DATABASE database_name Optional parameters: CHARACTER SET charset_name: Specify character set COLLATE collation_name: Specify collation rules
SQL statement to create a MySQL database
To create a MySQL database, you can use the following SQL statement:
<code class="sql">CREATE DATABASE database_name;</code>
Where, database_name
is the database to be created The name.
Example:
To create a database named "my_database", you can use the following SQL statement:
<code class="sql">CREATE DATABASE my_database;</code>
Optional parameters :
CREATE DATABASE
The statement can also include some optional parameters, such as:
Example:
To create a database named "my_database" and use the UTF-8 character set and utf8_general_ci collation rules, you can use the following SQL Statement:<code class="sql">CREATE DATABASE my_database CHARACTER SET utf8 COLLATE utf8_general_ci;</code>
The above is the detailed content of What are the sql statements to create a database in mysql?. For more information, please follow other related articles on the PHP Chinese website!