CREATE DATABASE
Contents
CREATE DATABASE#
Syntax#
CreateDatabaseStmt ::=
'CREATE' 'DATABASE' DBName
DBName ::=
Identifier
Description
The CREATE DATABASE
statement is used to create a new database on OpenMLDB. The database name must be unique. If a database with the same name already exists, an error will occur.
Example#
The following SQl command creates a database named db1
. If a database with the same name already exists, an error will be thrown.
CREATE DATABASE db1;
-- SUCCEED
Then create a database named db2
:
CREATE DATABASES db2;
-- SUCCEED
Show database list:
SHOW DATABASES;
-----------
Databases
-----------
db1
db2
-----------
2 rows in set
Repeatedly creating a database with the same name will throw an error:
CREATE DATABASE db1;
-- ERROR: Create database failed for database already exists