Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.37 KB

create-database.md

File metadata and controls

60 lines (39 loc) · 1.37 KB
title summary category
CREATE DATABASE | TiDB SQL Statement Reference
An overview of the usage of CREATE DATABASE for the TiDB database.
reference

CREATE DATABASE

This statement creates a new database in TiDB. The MySQL terminology for 'database' most closely maps to a schema in the SQL standard.

Synopsis

CreateDatabaseStmt:

CreateDatabaseStmt

DatabaseSym:

DatabaseSym

IfNotExists:

IfNotExists

DBName:

DBName

DatabaseOptionListOpt:

DatabaseOptionListOpt

Examples

mysql> CREATE DATABASE mynewdatabase;
Query OK, 0 rows affected (0.09 sec)

mysql> USE mynewdatabase;
Database changed
mysql> CREATE TABLE t1 (a int);
Query OK, 0 rows affected (0.11 sec)

mysql> SHOW TABLES;
+-------------------------+
| Tables_in_mynewdatabase |
+-------------------------+
| t1                      |
+-------------------------+
1 row in set (0.00 sec)

MySQL compatibility

This statement is understood to be fully compatible with MySQL. Any compatibility differences should be reported via an issue on GitHub.

See also