Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
CREATE DATABASE statement to create a database, users need to have the global CREATE permission.CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] database_name[database_option] ...database_option:[DEFAULT] {CHARACTER SET | CHARSET} [=] charset_name| [DEFAULT] COLLATE [=] collate_name
Parameter | Optional or Not | Description |
IF NOT EXISTS | Optional | Indicates that if the database already exists, it will not be created. When a database is created, if the database exists and no IF NOT EXISTS is specified, an error will be reported. |
database_name | Required | Specifies the name of the database to be created. |
[DEFAULT] {CHARACTER SET | CHARSET} [=] charset_name | Optional | Sets the character set (charset) of the database. |
[DEFAULT] COLLATE [=] collate_name | Optional | Sets the collation rules of the database. |
tdsql [(none)]> CREATE DATABASE IF NOT EXISTS test1 DEFAULT CHARACTER SET utf8;Query OK, 1 row affected
피드백